Skip to content

use different entitlements #54

use different entitlements

use different entitlements #54

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: |
APP_PATH="src-tauri/target/universal-apple-darwin/release/bundle/macos/defguard-client.app"
SIGN_ID="Developer ID Application: defguard sp. z o.o. (82GZ7KN29J)"
# Remove provisioning profiles (not needed for Developer ID distribution)
rm -f "$APP_PATH/Contents/embedded.provisionprofile"
rm -f "$APP_PATH/Contents/PlugIns/VPNExtension.appex/Contents/embedded.provisionprofile"
# Sign the VPN extension executable
codesign --force --options runtime --timestamp \
--sign "$SIGN_ID" \
--entitlements "swift/extension/VPNExtension/VPNExtension.developerid.entitlements" \
"$APP_PATH/Contents/PlugIns/VPNExtension.appex/Contents/MacOS/VPNExtension"
# Sign the VPN extension bundle
codesign --force --options runtime --timestamp \
--sign "$SIGN_ID" \
--entitlements "swift/extension/VPNExtension/VPNExtension.developerid.entitlements" \
"$APP_PATH/Contents/PlugIns/VPNExtension.appex"
# Sign the main executable
codesign --force --options runtime --timestamp \
--sign "$SIGN_ID" \
--entitlements "src-tauri/Client.developerid.entitlements" \
"$APP_PATH/Contents/MacOS/defguard-client"
# Sign the main app bundle
codesign --force --options runtime --timestamp \
--sign "$SIGN_ID" \
--entitlements "src-tauri/Client.developerid.entitlements" \
"$APP_PATH"
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