fix(ci): auto-reserve desktop store build versions

This commit is contained in:
DIYgod 2026-04-14 14:35:21 +08:00
parent 85c9c2901e
commit bd2f2cae0e
1 changed files with 36 additions and 1 deletions

View File

@ -165,13 +165,48 @@ jobs:
npx electron-forge make --arch=arm64 --platform=darwin ${{ env.PROD == 'false' && '--mode=staging' || '' }}
npx tsx scripts/merge-yml.ts
- name: Resolve desktop build version
if: runner.os == 'macOS' && github.event.inputs.store == 'true'
id: desktop_build_version
shell: bash
run: |
set -euo pipefail
build_version="${{ github.event.inputs.build_version }}"
if [ -n "$build_version" ]; then
echo "Using provided desktop build version: $build_version"
echo "build_version=$build_version" >> "$GITHUB_OUTPUT"
exit 0
fi
git fetch --tags --force
latest_tag="$(git tag -l 'desktop-build/v*' --sort=-v:refname | head -n 1)"
if [ -z "$latest_tag" ]; then
last_build=110
else
last_build="${latest_tag#desktop-build/v}"
fi
build_version=$((last_build + 1))
build_tag="desktop-build/v${build_version}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "$build_tag"
git push origin "$build_tag"
echo "Reserved desktop build version: ${build_version}"
echo "build_version=$build_version" >> "$GITHUB_OUTPUT"
- name: Build - Mac App Store
if: runner.os == 'macOS' && github.event.inputs.store == 'true'
env:
OSX_SIGN_KEYCHAIN_PATH: ${{ runner.temp }}/app-signing.keychain-db
OSX_SIGN_IDENTITY: ${{ secrets.OSX_SIGN_IDENTITY_MAS }}
OSX_SIGN_PROVISIONING_PROFILE_PATH: ${{ runner.temp }}/build_pp.provisionprofile
BUILD_VERSION: ${{ github.event.inputs.build_version }}
BUILD_VERSION: ${{ steps.desktop_build_version.outputs.build_version }}
working-directory: apps/desktop
run: pnpm build:electron-forge:mas