Fix window close on macOS (#992) #257
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: Build macOS app | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| - "release/**" | |
| paths-ignore: | |
| - "*.md" | |
| - "LICENSE" | |
| tags: | |
| - v*.*.* | |
| env: | |
| SQLX_OFFLINE: "1" | |
| 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@v6 | |
| 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} | |
| if [ "${GITHUB_REF_TYPE}" = "tag" ]; then | |
| echo "DEFGUARD_CLIENT_BUILD_VERSION=${GITHUB_REF_NAME#v}" >> ${GITHUB_ENV} | |
| fi | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 26 | |
| - uses: pnpm/action-setup@v6 | |
| with: | |
| cache: true | |
| version: 11 | |
| - name: Install Node dependencies for New UI | |
| run: | | |
| cd new-ui | |
| pnpm install --no-frozen-lockfile | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-darwin,x86_64-apple-darwin | |
| - 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 | |
| sed -i '' "s,@BUILD_NUMBER@,${{ github.run_number }}," src-tauri/client-cli/Info.plist | |
| - name: Unlock keychain | |
| run: security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain | |
| - name: Build new UI | |
| run: | | |
| cd new-ui | |
| pnpm build | |
| - name: Build app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| args: --target universal-apple-darwin | |
| # - name: Bundle Defguard CLI | |
| # env: | |
| # BUNDLE: "target/universal-apple-darwin/release/bundle/macos/Defguard.app" | |
| # run: | | |
| # cd src-tauri | |
| # mkdir -p ${BUNDLE}/Contents/Helpers/defguard-cli/Contents/MacOS | |
| # lipo -create -output ${BUNDLE}/Contents/Helpers/defguard-cli/Contents/MacOS/defguard-cli \ | |
| # target/aarch64-apple-darwin/release/defguard-cli \ | |
| # target/x86_64-apple-darwin/release/defguard-cli | |
| # ln -f client-cli/Info.plist ${BUNDLE}/Contents/Helpers/defguard-cli/Contents/Info.plist | |
| # pushd ${BUNDLE}/Contents/Helpers/defguard-cli/Contents | |
| # ln -f ../../../embedded.provisionprofile . | |
| # popd | |
| # codesign --verbose --force --options runtime \ | |
| # --sign "${{ env.APPLE_SIGNING_IDENTITY }}" \ | |
| # --prefix net.defguard. --entitlements Client.entitlements \ | |
| # ${BUNDLE}/Contents/Helpers/defguard-cli | |
| # codesign --verbose --force --options runtime \ | |
| # --sign "${{ env.APPLE_SIGNING_IDENTITY }}" \ | |
| # --entitlements Client.entitlements ${BUNDLE} | |
| - 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.app" /Applications defguard-client.pkg | |
| xcrun altool --api-key ${{ secrets.APPLE_API_KEY }} --api-issuer ${{ secrets.APPLE_API_ISSUER }} --upload-app --platform macos --file defguard-client.pkg --wait | |
| # 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 What's New | |
| env: | |
| APP_ID: "6754601166" | |
| run: | | |
| UPLOAD_DIR=$(mktemp -d) | |
| VERSION=$(jq -r '.version' package.json) | |
| mkdir -p "${UPLOAD_DIR}/beta-${APP_ID}/upload/MACOS" | |
| git log -1 --pretty='"whatsNew" = "%B";' > "${UPLOAD_DIR}/beta-${APP_ID}/upload/MACOS/en-US.txt" | |
| RETRIES=0 | |
| until [ ${RETRIES} -gt 6 ] | |
| do | |
| xcrun altool --api-key ${{ secrets.APPLE_API_KEY }} --api-issuer ${{ secrets.APPLE_API_ISSUER }} \ | |
| --apple-id ${APP_ID} --bundle-version ${{ github.run_number }} \--bundle-short-version-string ${VERSION} \ | |
| --platform macos --beta-app-store-text "${UPLOAD_DIR}" --upload && break | |
| echo "Waiting for app ${APP_ID} build ${{ github.run_number }} version ${VERSION}" | |
| sleep 10 | |
| ((RETRIES++)) | |
| done | |
| rm -f -r "${UPLOAD_DIR}" |