From 23d7bfa4e046d82cdd9a3ed625e48405e4fb9ff1 Mon Sep 17 00:00:00 2001 From: Acbox Date: Sun, 29 Mar 2026 20:26:51 +0800 Subject: [PATCH] fix(ci): handle pre-release version for Windows MSI bundle WiX MSI only supports numeric-only versions (X.Y.Z). When the tag contains a pre-release identifier (e.g. 0.6.0-beta.5), override the MSI version via `bundle.windows.wix.version` with the stripped numeric portion while keeping the full semver for other bundle formats. --- .github/workflows/tauri-release.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tauri-release.yml b/.github/workflows/tauri-release.yml index f5db98f7..b16d93be 100644 --- a/.github/workflows/tauri-release.yml +++ b/.github/workflows/tauri-release.yml @@ -41,8 +41,12 @@ jobs: run: | TAG="${GITHUB_REF_NAME}" VERSION="${TAG#v}" + # Strip pre-release/build metadata for MSI (only supports numeric X.Y.Z) + NUMERIC_VERSION="${VERSION%%-*}" + NUMERIC_VERSION="${NUMERIC_VERSION%%+*}" echo "version=$VERSION" >> "$GITHUB_OUTPUT" - echo "Resolved version: $VERSION" + echo "numeric_version=$NUMERIC_VERSION" >> "$GITHUB_OUTPUT" + echo "Resolved version: $VERSION (MSI: $NUMERIC_VERSION)" - name: Sync version to tauri.conf.json and Cargo.toml shell: bash @@ -96,13 +100,24 @@ jobs: - name: Install JS dependencies run: pnpm install --frozen-lockfile + - name: Prepare Tauri build args + id: tauri-args + shell: bash + run: | + ARGS="--target ${{ matrix.target }}" + if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then + MSI_VERSION="${{ steps.version.outputs.numeric_version }}" + ARGS="$ARGS --config {\"bundle\":{\"windows\":{\"wix\":{\"version\":\"$MSI_VERSION\"}}}}" + fi + echo "args=$ARGS" >> "$GITHUB_OUTPUT" + - name: Build and release Tauri app uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: projectPath: apps/desktop - args: --target ${{ matrix.target }} + args: ${{ steps.tauri-args.outputs.args }} tauriScript: pnpm tauri tagName: ${{ github.ref_name }} releaseName: "Memoh Desktop ${{ github.ref_name }}"