fix: build both Intel and Apple Silicon architectures for macOS
This commit is contained in:
parent
cb3a661611
commit
1b54447ccb
42
.github/workflows/build.yml
vendored
42
.github/workflows/build.yml
vendored
@ -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:
|
||||
|
||||
@ -29,11 +29,12 @@
|
||||
# 2. 将 tag 单独推送到 github 触发云端自动构建
|
||||
git push github vx.x.x
|
||||
```
|
||||
3. GitHub Actions 收到 Tag 后会自动触发构建,云端会启动三个环境:
|
||||
3. GitHub Actions 收到 Tag 后会自动触发构建,云端会启动多个编译任务,最终产出:
|
||||
- 💻 **Windows**:编译出 `CursorTokenLogin.exe`
|
||||
- 🍏 **macOS**:编译出 `CursorTokenLogin-macOS.zip` (内含 `.app` 应用程序)
|
||||
- 🍏 **macOS (M1/M2/M3 芯片)**:编译出 `CursorTokenLogin-macOS-AppleSilicon.zip` (解压即得 `.app`)
|
||||
- 🍏 **macOS (Intel 芯片)**:编译出 `CursorTokenLogin-macOS-Intel.zip` (解压即得 `.app`)
|
||||
- 🐧 **Linux**:编译出 Linux 运行文件,并自动打包为 `cursortokenlogin.deb` 和 `cursortokenlogin.rpm`
|
||||
4. **下载成品**:构建完成后(耗时约 3~5 分钟),GitHub 会自动在您的仓库右侧 **Releases** 栏目中生成一个名为 `v1.0.0` 的发布页,进入即可直接下载编译好的 4 个包!
|
||||
4. **下载成品**:构建完成后(耗时约 3~5 分钟),GitHub 会自动在您的仓库右侧 **Releases** 栏目中生成一个名为 `v1.0.0` 的发布页,进入即可直接下载编译好的 5 个安装包!
|
||||
|
||||
---
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user