如何为 FlowLauncher 插件 CI/CD 创建 GitHub actions 工作流程?

问题描述 投票:0回答:1

我的 FlowLauncher 插件需要一个 GitHub 操作工作流程。我复制了官方 FlowLauncher GitHub 操作模板,但出现了错误。我修复了一些可能导致错误的弱点,并最终得到以下代码:

name: Publish Release

on:
  workflow_dispatch:
  push:
    branches: [ main ]
    paths-ignore:
      - .github/workflows/*

jobs:
  publish:
    runs-on: ubuntu-latest
    env:
      python_ver: '3.12.1'

    steps:
      - uses: actions/checkout@v3
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
      - name: get version
        id: version
        uses: notiz-dev/github-action-json-property@release
        with:
          path: 'plugin.json'
          prop_path: 'Version'
      - run: echo ${{steps.version.outputs.prop}}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r ./requirements.txt -t ./lib
          zip -r Flow.Launcher.Plugin.MyPlugin.zip . -x '*.git*'
      - name: Publish
        if: success()
        uses: actions/create-release@v1
        with:
          files: 'Flow.Launcher.Plugin.MyPlugin.zip'
          tag_name: "v${{steps.version.outputs.prop}}"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

出现以下错误:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, actions/setup-python@v4, notiz-dev/github-action-json-property@release, softprops/action-gh-release@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

The `python-version` input is not set. The version of Python currently in `PATH` will be used.
plugins yaml github-actions cicd
1个回答
0
投票

Node.js 16 个操作已弃用。请更新以下操作以使用 Node.js 20:actions/checkout@v3、actions/setup-python@v4、notiz-dev/github-action-json-property@release、softprops/action-gh-release@v1。有关更多信息,请参阅:https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

当前(2024 年 4 月 2 日)每个版本的最新版本(支持 Node 20)是:

未设置

python-version

 输入。将使用当前 
PATH
 中的 Python 版本。

您在工作中以这种方式设置环境变量:

jobs: publish: runs-on: ubuntu-latest env: python_ver: '3.12.1' steps: ...
但是,您在步骤中使用

${{ matrix.python-version }}

,这与
矩阵策略相关(您不在此处配置)。您应该使用 ${{ env.python-ver }}
 来代替,如下所示:

jobs: publish: runs-on: ubuntu-latest env: python_ver: '3.12.1' steps: - uses: actions/[email protected] - name: Set up Python ${{ env.python-ver }} uses: actions/[email protected] with: python-version: ${{ env.python-ver }}
    
© www.soinside.com 2019 - 2024. All rights reserved.