Bump version to 0.11.2 #230
Workflow file for this run
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: macos | |
on: | |
# Triggers workflow on PR but only for main branch | |
pull_request: | |
branches: [ main ] | |
paths: | |
- 'macos/**' | |
- '.github/workflows/macos.yml' | |
- 'pubspec.yaml' | |
push: | |
# for release | |
tags: | |
- "v*.*.*" | |
- "test" | |
# Allows manual trigger from Actions tab | |
workflow_dispatch: | |
jobs: | |
build-macos: | |
# https://medium.com/flutter-community/build-sign-and-deliver-flutter-macos-desktop-applications-on-github-actions-5d9b69b0469c | |
runs-on: macos-latest | |
env: | |
MACOS_APP_RELEASE_PATH: build/macos/Build/Products/Release | |
APPNAME: "FleetingNotesMac" | |
IDENTITY_ID: 4MLDMH9QYL | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Adds env.json | |
env: | |
ENV_JSON: ${{ secrets.ENV_JSON }} | |
run: echo $ENV_JSON > env.json | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.13.5' | |
cache: true | |
channel: 'stable' | |
- run: flutter doctor -v | |
- run: flutter pub get | |
- name: Codesign executable | |
env: | |
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE_BASE64 }} | |
MACOS_PROVISION_PROFILE_BASE64: ${{ secrets.MACOS_PROVISION_PROFILE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# import certificate and provisioning profile from secrets | |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 | |
echo $MACOS_PROVISION_PROFILE_BASE64 | base64 --decode > mac.provisionprofile | |
# apply provisioning profile | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp mac.provisionprofile ~/Library/MobileDevice/Provisioning\ Profiles | |
echo "Create Keychain" | |
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain | |
echo "Assign to Login Keychain" | |
security default-keychain -s build.keychain | |
echo "Unlock the Login Keychain" | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain | |
echo "Set key chain timeout to 3600 seconds" | |
security set-keychain-settings -t 3600 -u build.keychain | |
echo "Import certificate" | |
security import certificate.p12 -k build.keychain -P "$P12_PASSWORD" -T /usr/bin/codesign | |
echo "Set Key Partition" | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain | |
echo "Find Identity" | |
security find-identity | |
- name: Build macOS app (sometimes fails so retry 3 times) | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 15 | |
max_attempts: 3 | |
retry_on: timeout | |
command: flutter build macos --release -v --dart-define-from-file=env.json | |
- name: Sign the app | |
run: /usr/bin/codesign --force --deep -s $IDENTITY_ID ./$MACOS_APP_RELEASE_PATH/Fleeting\ Notes.app | |
- name: Create a dmg | |
run: | | |
echo "Install create-dmg" | |
brew install create-dmg | |
cd $MACOS_APP_RELEASE_PATH | |
create-dmg \ | |
--volname "$APPNAME" \ | |
--window-pos 200 120 \ | |
--window-size 800 529 \ | |
--icon-size 130 \ | |
--text-size 14 \ | |
--icon "Fleeting Notes.app" 260 250 \ | |
--hide-extension "Fleeting Notes.app" \ | |
--app-drop-link 540 250 \ | |
--hdiutil-quiet \ | |
"$APPNAME.dmg" \ | |
"Fleeting Notes.app" | |
- name: Sign the dmg | |
run: /usr/bin/codesign --force --deep -s $IDENTITY_ID ./$MACOS_APP_RELEASE_PATH/$APPNAME.dmg | |
- run: ls -a $MACOS_APP_RELEASE_PATH | |
- uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
build/macos/Build/Products/Release/*.dmg | |
draft: true | |
fail_on_unmatched_files: true |