Skip to content

The only downloader you need. 下载器的集大成者。

refactor(build): 简化 macOS 构建工作流配置

XiaoYouChR0558f97dfb3e
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a0c36528..3f6ce9cc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -146,91 +146,18 @@ jobs:
Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}.zip
dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
- build-macos-14-arm:
+ build-macos:
if: ${{ github.event_name == 'release' || github.event.inputs.build_target == 'macos' || github.event.inputs.build_target == 'all' }}
strategy:
matrix:
- architecture: [ arm64 ]
- runs-on: macos-14
- steps:
- - name: Checkout
- uses: actions/checkout@v6
- with:
- fetch-depth: 0
-
- - name: Set up Python 3.11
- uses: actions/setup-python@v6
- with:
- python-version: '3.11'
-
- - name: Install dependencies
- run: |
- pip install --timeout=300 -r requirements.txt
-
- - name: Build with Nuitka
- run: |
- python3 -c "import sys; sys.path.append('./app/supports'); import config; print(config.VERSION)" > version.txt
- version=$(sed -n '4p' version.txt)
- echo "VERSION=${version}" >> "$GITHUB_ENV"
- rm -rf version.txt
- python3 deploy.py
- chmod +x "dist/Ghost-Downloader-3.app/Contents/MacOS/Ghost-Downloader-3"
- rm -rf "dist/Ghost-Downloader-3.build"
- rm -rf "dist/Ghost-Downloader-3.dist"
- mv "dist/Ghost-Downloader-3.app" "dist/Ghost Downloader.app"
- mv "app/assets/修复软件损坏" "dist/修复软件损坏"
- chmod +x "dist/修复软件损坏"
-
- - name: Install DMG tooling
- run: |
- brew list create-dmg >/dev/null 2>&1 || brew install create-dmg
-
- - name: Create DMG
- run: |
- DMG_NAME="Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg"
- DMG_SOURCE_DIR="dist/dmg-layout"
-
- rm -rf "$DMG_SOURCE_DIR"
- mkdir -p "$DMG_SOURCE_DIR"
- cp -R "dist/Ghost Downloader.app" "$DMG_SOURCE_DIR/"
- find "$DMG_SOURCE_DIR" -name ".DS_Store" -delete
-
- create-dmg \
- --volname "Ghost Downloader" \
- --volicon "app/assets/logo.icns" \
- --background "app/assets/backgroundImage-2X.png" \
- --window-pos 200 120 \
- --window-size 664 404 \
- --icon-size 72 \
- --text-size 14 \
- --icon "Ghost Downloader.app" 190 200 \
- --hide-extension "Ghost Downloader.app" \
- --app-drop-link 370 200 \
- --add-file "修复软件损坏" "dist/修复软件损坏" 610 200 \
- --hdiutil-quiet \
- --hdiutil-retries 10 \
- "$DMG_NAME" \
- "$DMG_SOURCE_DIR"
-
- - name: Upload to release
- uses: softprops/action-gh-release@v2
- if: ${{ github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') }}
- with:
- files: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg
-
- - name: Upload artifacts
- if: ${{ github.event_name == 'workflow_dispatch' }}
- uses: actions/upload-artifact@v4
- with:
- name: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}
- path: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg
-
- build-macos-15-x86_64:
- if: ${{ github.event_name == 'release' || github.event.inputs.build_target == 'macos' || github.event.inputs.build_target == 'all' }}
- strategy:
- matrix:
- architecture: [ x86_64 ]
- runs-on: macos-15-intel
+ include:
+ - architecture: arm64
+ runner: macos-14
+ openssl_workaround: 'false'
+ - architecture: x86_64
+ runner: macos-15-intel
+ openssl_workaround: 'true'
+ runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v6
@@ -238,6 +165,7 @@ jobs:
fetch-depth: 0
- name: Remove problematic brew libs
+ if: ${{ matrix.openssl_workaround == 'true' }}
run: |
brew remove --force --ignore-dependencies openssl@3
brew cleanup openssl@3
@@ -266,6 +194,7 @@ jobs:
chmod +x "dist/修复软件损坏"
- name: Reinstall openssl libs
+ if: ${{ matrix.openssl_workaround == 'true' }}
run: |
brew install openssl@3