test #57
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 macOS app | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| - "release/**" | |
| - build-pkgs | |
| paths-ignore: | |
| - "*.md" | |
| - "LICENSE" | |
| tags: | |
| - v*.*.* | |
| jobs: | |
| build-macos: | |
| runs-on: | |
| - self-hosted | |
| - macOS | |
| env: | |
| APPLE_SIGNING_IDENTITY: "Apple Distribution: defguard sp. z o.o. (82GZ7KN29J)" | |
| APPLE_SIGNING_IDENTITY_INSTALLER: "3rd Party Mac Developer Installer: defguard sp. z o.o. (82GZ7KN29J)" | |
| APPLE_PROVIDER_SHORT_NAME: "82GZ7KN29J" | |
| APPLE_ID: "kamil@defguard.net" | |
| APPLE_TEAM_ID: "82GZ7KN29J" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| # - name: Write release version | |
| # run: | | |
| # VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1) | |
| # echo Version: $VERSION | |
| # echo "VERSION=$VERSION" >> ${GITHUB_ENV} | |
| - name: Write release version | |
| run: | | |
| VERSION=1.6.0 | |
| echo Version: $VERSION | |
| echo "VERSION=$VERSION" >> ${GITHUB_ENV} | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| cache: "pnpm" | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV} | |
| - name: Install deps | |
| run: pnpm install --frozen-lockfile | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-darwin,x86_64-apple-darwin | |
| - name: Unlock keychain | |
| run: security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain | |
| - name: Set build number | |
| run: | | |
| sed -i '' "s,@BUILD_NUMBER@,${{ github.run_number }}," src-tauri/tauri.conf.json | |
| sed -i '' "s,@BUILD_NUMBER@,${{ github.run_number }}," swift/extension/VPNExtension.xcodeproj/project.pbxproj | |
| - name: Build app for Developer ID distribution | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DEVELOPER_ID_BUILD: "true" | |
| run: | | |
| cd src-tauri && cargo tauri build --bundles app --target universal-apple-darwin \ | |
| --config tauri.developerid.conf.json | |
| - name: Verify code signature | |
| run: | | |
| APP_PATH="src-tauri/target/universal-apple-darwin/release/bundle/macos/defguard-client.app" | |
| codesign --verify --deep --strict --verbose=2 "$APP_PATH" | |
| codesign -dvv "$APP_PATH" | |
| codesign -dvv "$APP_PATH/Contents/PlugIns/VPNExtension.appex" | |
| - name: Build installation package for GitHub Release | |
| run: | | |
| security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain | |
| xcrun productbuild --sign "Developer ID Installer: defguard sp. z o.o. (82GZ7KN29J)" \ | |
| --component "src-tauri/target/universal-apple-darwin/release/bundle/macos/defguard-client.app" /Applications \ | |
| defguard-client.pkg | |
| xcrun notarytool submit --wait --apple-id ${{ env.APPLE_ID }} \ | |
| --password ${{ secrets.NOTARYTOOL_APP_SPECIFIC_PASSWORD }} \ | |
| --team-id ${{ env.APPLE_TEAM_ID }} defguard-client.pkg | |
| xcrun stapler staple defguard-client.pkg | |
| # now upload the artifact so i can download it from action | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: defguard-client.pkg | |
| path: defguard-client.pkg | |
| # - name: Upload installation package | |
| # uses: actions/upload-release-asset@v1 | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # with: | |
| # upload_url: ${{ needs.create-release.outputs.upload_url }} | |
| # asset_path: defguard-client.pkg | |
| # asset_name: defguard-client-universal-${{ env.VERSION }}.pkg | |
| # asset_content_type: application/octet-stream |