From a43674defc0c56c33265c644ad5507c117e7f1a7 Mon Sep 17 00:00:00 2001 From: TrueNine Date: Mon, 16 Feb 2026 01:19:48 +0800 Subject: [PATCH] fix(ci): replace tag trigger with workflow_call for GUI release CLI workflow now directly calls GUI workflow via workflow_call with explicit version input, eliminating the indirect tag-based chaining and the redundant check-version job. Closes #3 Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release-cli.yml | 14 +++++++ .github/workflows/release-gui.yml | 63 +++++++++---------------------- 2 files changed, 31 insertions(+), 46 deletions(-) diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 318020d6..6792b48c 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -10,9 +10,15 @@ on: - main workflow_dispatch: +permissions: + contents: write + jobs: release-cli: runs-on: ubuntu-24.04 + outputs: + publish: ${{ steps.check.outputs.publish }} + version: ${{ steps.check.outputs.version }} steps: - uses: actions/checkout@v4 with: @@ -95,3 +101,11 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git tag "v${version}" git push origin "v${version}" + + release-gui: + needs: release-cli + if: needs.release-cli.outputs.publish == 'true' + uses: ./.github/workflows/release-gui.yml + with: + version: ${{ needs.release-cli.outputs.version }} + secrets: inherit diff --git a/.github/workflows/release-gui.yml b/.github/workflows/release-gui.yml index a402836e..f2ccbfa8 100644 --- a/.github/workflows/release-gui.yml +++ b/.github/workflows/release-gui.yml @@ -1,55 +1,27 @@ name: Release GUI concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ inputs.version || github.run_id }} cancel-in-progress: true on: - push: - tags: - - 'v*' + workflow_call: + inputs: + version: + required: true + type: string workflow_dispatch: + inputs: + version: + description: 'Version to release (without v prefix, e.g. 2026.10213.0)' + required: true + type: string permissions: contents: write jobs: - check-version: - runs-on: ubuntu-24.04 - outputs: - version: ${{ steps.version.outputs.version }} - release_exists: ${{ steps.check-release.outputs.exists }} - 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=${{ 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" - else - echo "Release v${version} does not exist, will build and publish" - echo "exists=false" >> "$GITHUB_OUTPUT" - fi - build-gui: - needs: check-version - if: needs.check-version.outputs.release_exists != 'true' strategy: fail-fast: false matrix: @@ -121,14 +93,14 @@ jobs: - name: Install workspace dependencies run: pnpm install --frozen-lockfile - - name: Sync Tauri version from package.json + - name: Sync Tauri version from CLI shell: bash run: | - version=$(jq -r '.version' cli/package.json) + version="${{ inputs.version }}" sed -i.bak "s/^version = \".*\"/version = \"${version}\"/" gui/src-tauri/Cargo.toml rm -f gui/src-tauri/Cargo.toml.bak jq --arg v "$version" '.version = $v' gui/src-tauri/tauri.conf.json > gui/src-tauri/tauri.conf.tmp && mv gui/src-tauri/tauri.conf.tmp gui/src-tauri/tauri.conf.json - echo "Synced Cargo.toml and tauri.conf.json version to ${version}" + echo "Synced version to ${version}" - name: Clean old bundle artifacts shell: bash @@ -154,8 +126,7 @@ jobs: if-no-files-found: error publish-release: - needs: [check-version, build-gui] - if: always() && needs.check-version.outputs.release_exists != 'true' && needs.build-gui.result == 'success' + needs: build-gui runs-on: ubuntu-24.04 steps: - name: Download all artifacts @@ -172,8 +143,8 @@ jobs: - name: Publish Release uses: softprops/action-gh-release@v2.5.0 with: - tag_name: v${{ needs.check-version.outputs.version }} - name: v${{ needs.check-version.outputs.version }} + tag_name: v${{ inputs.version }} + name: v${{ inputs.version }} files: | artifacts/**/*.dmg artifacts/**/*.exe