Build Desktop Test #4
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: Build Desktop Test | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: "Branch, tag, or commit to build." | |
| required: false | |
| default: main | |
| type: string | |
| platform: | |
| description: "Platform to build." | |
| required: false | |
| default: all | |
| type: choice | |
| options: | |
| - all | |
| - macos | |
| - windows | |
| mac_signing: | |
| description: "macOS signing mode." | |
| required: false | |
| default: developer-id-skip-stapling | |
| type: choice | |
| options: | |
| - developer-id-skip-stapling | |
| - developer-id-notarized | |
| - adhoc | |
| - unsigned | |
| permissions: | |
| contents: read | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| macos: | |
| name: build-test (macos-universal) | |
| if: ${{ inputs.platform == 'all' || inputs.platform == 'macos' }} | |
| runs-on: macos-latest | |
| env: | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
| APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
| APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} | |
| APPLE_ID: ${{ secrets.APPLE_ID }} | |
| APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.ref }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.23.0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-darwin,x86_64-apple-darwin | |
| - name: Cache Rust build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| src-tauri/target | |
| key: test-rust-${{ runner.os }}-macos-universal-${{ hashFiles('src-tauri/Cargo.lock') }} | |
| restore-keys: | | |
| test-rust-${{ runner.os }}-macos-universal- | |
| rust-${{ runner.os }}-macos-universal- | |
| rust-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Resolve test build version | |
| id: version | |
| shell: bash | |
| run: | | |
| ref="${{ inputs.ref }}" | |
| if [[ "$ref" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+([-.+][0-9A-Za-z.-]+)?$ ]]; then | |
| version="${ref#v}" | |
| else | |
| version="1.0.0-test.${GITHUB_RUN_NUMBER}" | |
| fi | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Apply test build version | |
| shell: bash | |
| run: node scripts/release/prepare-release.mjs "${{ steps.version.outputs.version }}" beta | |
| - name: Import Apple signing certificate | |
| if: startsWith(inputs.mac_signing, 'developer-id') | |
| shell: bash | |
| run: | | |
| certificate_path="$RUNNER_TEMP/apple-certificate.p12" | |
| keychain_path="$RUNNER_TEMP/apple-signing.keychain-db" | |
| echo "$APPLE_CERTIFICATE" | base64 --decode > "$certificate_path" | |
| security create-keychain -p "$KEYCHAIN_PASSWORD" "$keychain_path" | |
| security set-keychain-settings -lut 21600 "$keychain_path" | |
| security default-keychain -s "$keychain_path" | |
| security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$keychain_path" | |
| security import "$certificate_path" -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign -k "$keychain_path" | |
| security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$keychain_path" | |
| security list-keychains -d user -s "$keychain_path" $(security list-keychains -d user | sed 's/[\" ]//g') | |
| security find-identity -v -p codesigning "$keychain_path" | |
| - name: Build desktop bundle | |
| shell: bash | |
| run: | | |
| extra_args=() | |
| case "${{ inputs.mac_signing }}" in | |
| developer-id-skip-stapling) | |
| extra_args+=(--skip-stapling) | |
| ;; | |
| developer-id-notarized) | |
| ;; | |
| adhoc) | |
| unset APPLE_CERTIFICATE APPLE_CERTIFICATE_PASSWORD APPLE_SIGNING_IDENTITY APPLE_ID APPLE_PASSWORD APPLE_TEAM_ID KEYCHAIN_PASSWORD | |
| extra_args+=(--config '{"bundle":{"macOS":{"signingIdentity":"-","hardenedRuntime":false}}}') | |
| ;; | |
| unsigned) | |
| extra_args+=(--no-sign) | |
| ;; | |
| esac | |
| pnpm tauri build --target universal-apple-darwin "${extra_args[@]}" | |
| - name: Stage bundle artifacts | |
| shell: bash | |
| env: | |
| BUNDLE_SOURCE_DIR: src-tauri/target/universal-apple-darwin/release/bundle | |
| RELEASE_BUILD_ID: macos-universal-test | |
| RELEASE_STAGE_DIR: release-artifacts | |
| run: node scripts/release/stage-bundle-artifacts.mjs | |
| - name: Upload bundle artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-bundle-macos-universal | |
| path: release-artifacts/macos-universal-test/* | |
| if-no-files-found: error | |
| windows: | |
| name: build-test (windows-x86_64) | |
| if: ${{ inputs.platform == 'all' || inputs.platform == 'windows' }} | |
| runs-on: windows-latest | |
| env: | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.ref }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.23.0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| src-tauri/target | |
| key: test-rust-${{ runner.os }}-windows-x86_64-${{ hashFiles('src-tauri/Cargo.lock') }} | |
| restore-keys: | | |
| test-rust-${{ runner.os }}-windows-x86_64- | |
| rust-${{ runner.os }}-windows-x86_64- | |
| rust-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Resolve test build version | |
| id: version | |
| shell: bash | |
| run: | | |
| ref="${{ inputs.ref }}" | |
| if [[ "$ref" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+([-.+][0-9A-Za-z.-]+)?$ ]]; then | |
| version="${ref#v}" | |
| else | |
| version="1.0.0-test.${GITHUB_RUN_NUMBER}" | |
| fi | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Apply test build version | |
| shell: bash | |
| env: | |
| RELEASE_WINDOWS_BUNDLE_VERSION: true | |
| run: node scripts/release/prepare-release.mjs "${{ steps.version.outputs.version }}" beta | |
| - name: Build desktop bundle | |
| shell: bash | |
| run: pnpm tauri build | |
| - name: Stage bundle artifacts | |
| shell: bash | |
| env: | |
| BUNDLE_SOURCE_DIR: src-tauri/target/release/bundle | |
| RELEASE_BUILD_ID: windows-x86_64-test | |
| RELEASE_STAGE_DIR: release-artifacts | |
| run: node scripts/release/stage-bundle-artifacts.mjs | |
| - name: Upload bundle artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-bundle-windows-x86_64 | |
| path: release-artifacts/windows-x86_64-test/* | |
| if-no-files-found: error |