Build and package #597
This file contains 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 and package | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
workflow_dispatch: | |
jobs: | |
build_macos: | |
runs-on: macos-latest | |
name: Build app bundle | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Import signing certificate into keychain | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
p12-file-base64: ${{ secrets.SIGNING_CERTIFICATE_P12_DATA }} | |
p12-password: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }} | |
- name: Store notary service credentials in keychain | |
run: | | |
xcrun notarytool store-credentials \ | |
--team-id $TEAM_ID \ | |
--apple-id $APPLE_ID \ | |
--password ${{ secrets.NOTARIZE_PASSWORD }} \ | |
"briefcase-macOS-$TEAM_ID" | |
env: | |
APPLE_ID: "[email protected]" | |
TEAM_ID: "G34LNR8C4Y" | |
- name: Set up Python | |
run: | | |
wget -q https://www.python.org/ftp/python/3.11.0/python-3.11.0-macos11.pkg | |
sudo installer -pkg python-3.11.0-macos11.pkg -target / | |
python3 -c "import sys; print(sys.version)" | |
echo "/Library/Frameworks/Python.framework/Versions/3.11/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: | | |
python3 -m pip install -U pip | |
python3 -m pip install -U briefcase | |
python3 -m pip install -U bump2version | |
- name: Bump build number | |
run: | | |
bump2version major --config-file .bumpversion-build.cfg | |
- name: Build app | |
id: build | |
run: | | |
# Update app code and dependencies. | |
briefcase create macOS Xcode --no-input | |
# Build app. | |
briefcase build macOS Xcode --no-input | |
# Run post-build scripts. | |
# - add CLI executable | |
# - keep .pyc files only to save space | |
APP_PATH=$( find . -name "*Maestral.app" | head -n 1) | |
python3 scripts/post-build-macos.py $APP_PATH | |
# Package as dmg. | |
briefcase package macOS Xcode -i "$DEV_ID" --no-input | |
# Prepare output for upload. | |
DMG_PATH=$( find . -name "*.dmg" ) | |
DMG_NAME=$( basename "$DMG_PATH" ) | |
echo "dmg created: $DMG_PATH" | |
echo "dmg_name=${DMG_NAME}" >> $GITHUB_OUTPUT | |
echo "dmg_path=${DMG_PATH}" >> $GITHUB_OUTPUT | |
env: | |
DEV_ID: "Developer ID Application: Sam Schott (G34LNR8C4Y)" | |
PIP_NO_BINARY: "watchdog" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build.outputs.dmg_name }} | |
path: ${{ steps.build.outputs.dmg_path }} | |
- name: Push back Xcode project updates | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
if: github.event_name == 'push' | |
with: | |
commit_message: Auto-commit build updates | |
branch: main | |
- name: Push back Xcode project updates | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
if: github.event_name != 'push' | |
with: | |
commit_message: Auto-commit build updates |