Skip to content

rerun

rerun #47

Workflow file for this run

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
# Switch back to tauri-action when this gets merged https://github.com/tauri-apps/tauri/pull/14379
# uses: tauri-apps/tauri-action@v0 # 0.5.24 seems to be broken, TODO: update when fixed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
# APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
run: cd src-tauri && cargo tauri build --bundles app --target universal-apple-darwin
# with:
# args: --target universal-apple-darwin
# - name: Build installation package
# run: |
# security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain
# xcrun productbuild --sign "${{ env.APPLE_SIGNING_IDENTITY_INSTALLER }}" --component "src-tauri/target/universal-apple-darwin/release/bundle/macos/defguard-client.app" /Applications defguard-client.pkg
# xcrun altool --upload-app --type macos --file defguard-client.pkg --apiKey ${{ secrets.APPLE_API_KEY }} --apiIssuer ${{ secrets.APPLE_API_ISSUER }}
# # 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
- name: Re-sign app for direct distribution
run: |
# Re-sign the app with Developer ID for direct distribution
codesign --force --deep --sign "Developer ID Application: defguard sp. z o.o. (82GZ7KN29J)" \
"src-tauri/target/universal-apple-darwin/release/bundle/macos/defguard-client.app"
- name: Build installation package for GitHub Release
run: |
# Unlock keychain again before signing (it may have auto-locked)
security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain
## security set-keychain-settings -t 3600 -u 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
# Notarize for Gatekeeper
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
# - 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