scripts #128
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 MacOS | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
build: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
arch: [x86_64, arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.22.2' | |
- name: Update Build Number | |
run: | | |
commit_count=$(git rev-list --count HEAD) | |
sed -i "s/version: \(.*\)+.*/version: \1+$commit_count/" pubspec.yaml | |
- name: Install Apple Certificate | |
uses: apple-actions/import-codesign-certs@v1 | |
with: | |
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }} | |
p12-password: ${{ secrets.APPLE_PASSWORD }} | |
- name: Install the provisioning profile | |
run: | | |
mkdir -p ~/Library/Developer/Xcode/Provisioning\ Profiles | |
echo "${{ secrets.APPLE_PROVISION_PROFILE }}" | base64 --decode > ~/Library/Developer/Xcode/Provisioning\ Profiles/Github_Actions.provisionprofile | |
- name: Build macOS App | |
run: | | |
flutter pub get | |
flutter build macos | |
- name: Sign macOS App | |
run: | | |
codesign --deep --force --verbose --options runtime --timestamp --sign "${{ secrets.APPLE_DEVELOPER_ID_APPLICATION }}" build/macos/Build/Products/Release/maid.app | |
find build/macos/Build/Products/Release/maid.app -type d -name "*.framework" -exec codesign --force --verbose --options runtime --timestamp --sign "${{ secrets.APPLE_DEVELOPER_ID_APPLICATION }}" {} \; | |
find build/macos/Build/Products/Release/maid.app -type f -exec codesign --force --verbose --options runtime --timestamp --sign "${{ secrets.APPLE_DEVELOPER_ID_APPLICATION }}" {} \; | |
codesign --verify --deep --strict --verbose build/macos/Build/Products/Release/maid.app | |
- name: Compress macOS App | |
run: | | |
ditto -c -k --sequesterRsrc --keepParent "build/macos/Build/Products/Release/maid.app" "maid.zip" | |
- name: Notarize macOS App | |
run: | | |
xcrun notarytool store-credentials --apple-id ${{ secrets.APPLE_ID }} --password ${{ secrets.APPLE_APPLICATION_SPECIFIC_PASSWORD }} --team-id ${{ secrets.APPLE_TEAM_ID }} --validate notorization_profile | |
xcrun notarytool submit --keychain-profile "notorization_profile" --progress --wait maid.zip | |
- name: Staple Notarization Ticket | |
run: | | |
xcrun stapler staple "build/macos/Build/Products/Release/maid.app" | |
- name: Create DMG | |
run: ./scripts/create_dmg.sh | |
- name: Upload macOS Build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: maid-macos-${{ matrix.arch }} | |
path: dmg | |
timeout-minutes: 20 |