ci: fix MAS pkg build and add core_foundation_sys cfg guard #9
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| publish-tauri: | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: 'ubuntu-22.04' | |
| args: '' | |
| - platform: 'windows-latest' | |
| args: '' | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install dependencies (Ubuntu only) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
| - name: Install frontend dependencies | |
| run: npm install | |
| - name: Build Tauri | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tagName: ${{ github.ref_name }} | |
| releaseName: 'Light MD ${{ github.ref_name }}' | |
| releaseBody: | | |
| **Light MD ${{ github.ref_name }}** | |
| ### 安装说明 | |
| - **macOS**: 请从 Mac App Store 下载,或从本 Release 的 `.dmg` 安装。 | |
| - **Windows**: 下载 `.msi` 或 `.exe` 安装包,双击安装。Windows Defender 可能会提示,点击"更多信息" →"仍要运行"。 | |
| - **Linux**: 下载 `.deb` 或 `.AppImage`,双击运行。 | |
| ### 系统要求 | |
| - macOS 11+ (Apple Silicon / Intel) | |
| - Windows 10+ | |
| - Ubuntu 20.04+ / 其他支持 AppImage 的 Linux 发行版 | |
| releaseDraft: true | |
| prerelease: false | |
| args: ${{ matrix.args }} | |
| publish-direct-dmg: | |
| permissions: | |
| contents: write | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: 'aarch64-apple-darwin,x86_64-apple-darwin' | |
| - name: Install frontend dependencies | |
| run: npm install | |
| - name: Import Apple Developer ID certificate | |
| uses: apple-actions/import-codesign-certs@v3 | |
| with: | |
| p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }} | |
| p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
| - name: Build Tauri (direct .dmg) | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| APPLE_SIGNING_IDENTITY: "Developer ID Application: Tan Zaichao (UWJL48X4C8)" | |
| APPLE_TEAM_ID: "UWJL48X4C8" | |
| APPLE_ID: ${{ secrets.APPLE_ID }} | |
| APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
| with: | |
| tagName: ${{ github.ref_name }} | |
| releaseName: 'Light MD ${{ github.ref_name }}' | |
| releaseBody: | | |
| **Light MD ${{ github.ref_name }}** | |
| ### 安装说明 | |
| - **macOS**: 请从 Mac App Store 下载,或从本 Release 的 `.dmg` 安装。 | |
| - **Windows**: 下载 `.msi` 或 `.exe` 安装包,双击安装。Windows Defender 可能会提示,点击"更多信息" →"仍要运行"。 | |
| - **Linux**: 下载 `.deb` 或 `.AppImage`,双击运行。 | |
| ### 系统要求 | |
| - macOS 11+ (Apple Silicon / Intel) | |
| - Windows 10+ | |
| - Ubuntu 20.04+ / 其他支持 AppImage 的 Linux 发行版 | |
| releaseDraft: true | |
| prerelease: false | |
| args: '--target universal-apple-darwin --bundles dmg' | |
| publish-mas: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: 'aarch64-apple-darwin,x86_64-apple-darwin' | |
| - name: Install frontend dependencies | |
| run: npm install | |
| - name: Import Mac App Distribution certificate | |
| uses: apple-actions/import-codesign-certs@v3 | |
| with: | |
| keychain: signing_temp_app | |
| create-keychain: true | |
| p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_MAS }} | |
| p12-password: ${{ secrets.APPLE_CERTIFICATE_MAS_PASSWORD }} | |
| - name: Import Mac Installer Distribution certificate | |
| uses: apple-actions/import-codesign-certs@v3 | |
| with: | |
| keychain: signing_temp_installer | |
| create-keychain: true | |
| p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_MAS_INSTALLER }} | |
| p12-password: ${{ secrets.APPLE_CERTIFICATE_MAS_INSTALLER_PASSWORD }} | |
| - name: Build Tauri (MAS .app) | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| APPLE_SIGNING_IDENTITY: "3rd Party Mac Developer Application: Tan Zaichao (UWJL48X4C8)" | |
| APPLE_TEAM_ID: "UWJL48X4C8" | |
| with: | |
| args: '--target universal-apple-darwin --bundles app' | |
| - name: Build MAS installer .pkg | |
| env: | |
| INSTALLER_IDENTITY: "3rd Party Mac Developer Installer: Tan Zaichao (UWJL48X4C8)" | |
| run: | | |
| APP_PATH="src-tauri/target/universal-apple-darwin/release/bundle/macos/Light MD.app" | |
| PKG_PATH="src-tauri/target/universal-apple-darwin/release/bundle/macos/Light MD.pkg" | |
| mkdir -p "src-tauri/target/universal-apple-darwin/release/bundle/macos" | |
| productbuild --component "$APP_PATH" /Applications "$PKG_PATH" --sign "$INSTALLER_IDENTITY" | |
| - name: Write App Store Connect API key | |
| env: | |
| APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} | |
| APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
| run: | | |
| mkdir -p ~/.private_keys | |
| echo "$APPLE_API_KEY" | base64 -d > ~/.private_keys/AuthKey_${APPLE_API_KEY_ID}.p8 | |
| - name: Upload to App Store Connect | |
| env: | |
| APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
| APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} | |
| run: | | |
| xcrun altool --upload-app \ | |
| --type macos \ | |
| --file "src-tauri/target/universal-apple-darwin/release/bundle/macos/Light MD.pkg" \ | |
| --apiKey "$APPLE_API_KEY_ID" \ | |
| --apiIssuer "$APPLE_API_ISSUER" |