From c137db55f99fcaf31b8b8284a280fb2ddd2efc74 Mon Sep 17 00:00:00 2001 From: tidex <46107860+tidexe@users.noreply.github.com> Date: Sun, 16 Feb 2025 15:53:25 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=9B=B4=E6=96=B0=20Release=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化工作流触发条件,仅在 Build 工作流完成后触发 - 限定触发分支为 master - 更新 action-gh-release 版本至 v2 - 调整发布逻辑,仅在带有 refs/tags/ 前缀的引用上进行发布 --- .github/workflows/create-release.yml | 34 ++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 3c7813bb..cd7371df 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -1,24 +1,20 @@ -name: Create Release +name: Release + on: - workflow_dispatch: # 手动发布 - workflow_run: # 当 build 流程成功完成后自动触发 - workflows: ["Build Artifacts"] - types: [completed] + workflow_run: + workflows: ["Build"] # 监听名为“Build”的工作流 + types: + - completed # 当Build工作流完成时触发 + branches: + - master # 限定分支 jobs: release: - if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest - steps: - - name: Download Artifact - uses: actions/download-artifact@v3 - with: - name: binaries - - name: Create Release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} - with: - tag_name: v$(date +%s) - files: | - *.tar.gz + # 仅在Build工作流成功时运行 + if: github.event.workflow_run.conclusion == 'success' + + steps: + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') \ No newline at end of file