fix: build both Intel and Apple Silicon architectures for macOS

This commit is contained in:
2026-06-16 17:10:44 +08:00
parent cb3a661611
commit 1b54447ccb
2 changed files with 25 additions and 24 deletions
+21 -21
View File
@@ -38,7 +38,10 @@ jobs:
# 2. 编译 macOS 端 (.app)
build-macos:
runs-on: macos-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, macos-latest]
steps:
- name: Checkout Code
uses: actions/checkout@v4
@@ -55,21 +58,29 @@ jobs:
pip install -r requirements.txt
pip install pyinstaller Pillow
- name: Set Architecture Name
run: |
if [ "${{ matrix.os }}" = "macos-13" ]; then
echo "ARCH_NAME=Intel" >> $GITHUB_ENV
else
echo "ARCH_NAME=AppleSilicon" >> $GITHUB_ENV
fi
shell: bash
- name: Build App Bundle
run: |
python -m PyInstaller build.spec --clean
- name: Zip macOS App
run: |
# macOS app 实质上是文件夹,发布前需要打包成 zip
cd dist
zip -r CursorTokenLogin-macOS.zip CursorTokenLogin.app
zip -r CursorTokenLogin-macOS-${{ env.ARCH_NAME }}.zip CursorTokenLogin.app
- name: Upload macOS Artifact
uses: actions/upload-artifact@v4
with:
name: CursorTokenLogin-macOS
path: dist/CursorTokenLogin-macOS.zip
name: CursorTokenLogin-macOS-${{ env.ARCH_NAME }}
path: dist/CursorTokenLogin-macOS-${{ env.ARCH_NAME }}.zip
# 3. 编译 Linux 端并打包为 .deb 和 .rpm
build-linux:
@@ -153,36 +164,25 @@ jobs:
cursortokenlogin.deb
cursortokenlogin.rpm
# 4. 自动创建 GitHub Release 并上传 4 个包
# 4. 自动创建 GitHub Release 并上传 5 个包
create-release:
needs: [build-windows, build-macos, build-linux]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') # 仅在推送 tag 时执行 Release 发布
steps:
- name: Download Windows Artifact
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
name: CursorTokenLogin-Windows
path: ./release-files
- name: Download macOS Artifact
uses: actions/download-artifact@v4
with:
name: CursorTokenLogin-macOS
path: ./release-files
- name: Download Linux Artifacts
uses: actions/download-artifact@v4
with:
name: CursorTokenLogin-Linux
path: ./release-files
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
release-files/CursorTokenLogin.exe
release-files/CursorTokenLogin-macOS.zip
release-files/CursorTokenLogin-macOS-Intel.zip
release-files/CursorTokenLogin-macOS-AppleSilicon.zip
release-files/cursortokenlogin.deb
release-files/cursortokenlogin.rpm
env: