ci: 解决ci打包失败问题 #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: macOS Build | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| jobs: | |
| build-macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-14 | |
| arch: arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller==6.5.0 | |
| - name: Build with PyInstaller | |
| run: | | |
| pyinstaller build.spec --noconfirm | |
| - name: Prepare bundle | |
| run: | | |
| mkdir -p package | |
| APP_PATH=$(find dist -maxdepth 2 -name "*.app" | head -n 1) | |
| if [ -z "$APP_PATH" ]; then | |
| echo "❌ .app bundle not found under dist/" | |
| exit 1 | |
| fi | |
| echo "Found app $APP_PATH" | |
| cp -R "$APP_PATH" package/ | |
| cp -R fonts ui pdfjs models pdf2zh_config.json package/ | |
| - name: Create DMG | |
| run: | | |
| hdiutil create -volname FreePDF -srcfolder package -ov -format UDZO FreePDF-${{ matrix.arch }}.dmg | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: FreePDF-mac-${{ matrix.arch }} | |
| path: FreePDF-${{ matrix.arch }}.dmg | |
| if-no-files-found: error |