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.
This commit is contained in:
Acbox
2026-03-29 20:26:51 +08:00
parent bff9055d28
commit 23d7bfa4e0
+17 -2
View File
@@ -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 }}"