From 32436274804467d2d62c9966877dbf1b46db1b2b Mon Sep 17 00:00:00 2001 From: TrueNine Date: Mon, 16 Feb 2026 00:58:32 +0800 Subject: [PATCH] fix(ci): add Git tag creation and tag-based GUI release trigger Closes #1 Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release-cli.yml | 9 +++++++++ .github/workflows/release-gui.yml | 29 +++++++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 2588299c..318020d6 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -86,3 +86,12 @@ jobs: run: pnpm publish --access public --no-git-checks env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Create and push Git tag + if: steps.check.outputs.publish == 'true' + run: | + version=${{ steps.check.outputs.version }} + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git tag "v${version}" + git push origin "v${version}" diff --git a/.github/workflows/release-gui.yml b/.github/workflows/release-gui.yml index 66f409cf..522910b4 100644 --- a/.github/workflows/release-gui.yml +++ b/.github/workflows/release-gui.yml @@ -5,10 +5,9 @@ concurrency: cancel-in-progress: true on: - workflow_run: - workflows: ['Release CLI'] - types: - - completed + push: + tags: + - 'v*' workflow_dispatch: permissions: @@ -16,7 +15,6 @@ permissions: jobs: check-version: - if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-24.04 outputs: version: ${{ steps.version.outputs.version }} @@ -24,13 +22,23 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Get version + id: version + run: | + if [[ "${{ github.ref_type }}" == "tag" ]]; then + version="${{ github.ref_name }}" + version="${version#v}" + else + version=$(jq -r '.version' cli/package.json) + fi + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: Check GitHub Release exists id: check-release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - version=$(jq -r '.version' cli/package.json) - echo "version=$version" >> "$GITHUB_OUTPUT" + version=${{ steps.version.outputs.version }} if gh release view "v${version}" &> /dev/null; then echo "Release v${version} already exists, skipping" echo "exists=true" >> "$GITHUB_OUTPUT" @@ -39,13 +47,6 @@ jobs: echo "exists=false" >> "$GITHUB_OUTPUT" fi - - name: Get version - id: version - if: steps.check-release.outputs.exists != 'true' - run: | - version=${{ steps.check-release.outputs.version }} - echo "version=$version" >> "$GITHUB_OUTPUT" - build-gui: needs: check-version if: needs.check-version.outputs.release_exists != 'true'