Skip to content

Commit

Permalink
chore(ci): build and deploy notarized macOS disk image
Browse files Browse the repository at this point in the history
  • Loading branch information
JagandeepBrar committed Apr 4, 2022
1 parent 7c57d40 commit 8f3a7ab
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 35 deletions.
7 changes: 6 additions & 1 deletion .github/actions/prepare_for_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ runs:
run: |
npm install -g firebase-tools
dart pub global activate flutterfire_cli
flutterfire configure -y
flutterfire configure \
--android-app-id=app.lunasea.lunasea \
--ios-bundle-id=app.lunasea.lunasea \
--macos-bundle-id=app.lunasea.lunasea \
--yes
- name: Setup Android Platform
if: ${{ inputs.platform == 'android' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
build-playstore-package:
name: Play Store Package
name: Play Store
runs-on: ubuntu-latest
steps:
- name: Setup Environment
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ on:
required: true

jobs:
build-appstore-package:
name: App Store Package
build-app-store:
name: App Store
runs-on: macos-latest
steps:
- name: Setup Environment
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
required: true

jobs:
build-snap:
name: Snap
build-snapcraft:
name: Snapcraft
runs-on: ubuntu-latest
steps:
- name: Setup Environment
Expand All @@ -32,5 +32,5 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: linux-snap
name: linux-snapcraft
path: ${{ github.workspace }}/output
59 changes: 52 additions & 7 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
build-number:
required: true
type: string
build-version:
required: true
type: string

secrets:
APPLE_ID:
Expand Down Expand Up @@ -36,37 +39,41 @@ on:
required: true

jobs:
build-appstore-package:
name: App Store Package
build-app-store:
name: App Store
runs-on: macos-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: macos
appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }}
match-ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }}

- name: Build LunaSea
working-directory: ${{ github.workspace }}/macos
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ github.workspace }}/keys/appstore.p8
APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MACOS_INSTALLER_CERT_APP_STORE: ${{ secrets.MACOS_INSTALLER_CERT_APP_STORE }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: bundle exec fastlane build_appstore build_number:${{ inputs.build-number }}
run: bundle exec fastlane build_app_store build_number:${{ inputs.build-number }}

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: macos-appstore-package
path: ${{ github.workspace }}/output

build-noatized-package:
name: Notarized Package
build-app-package:
name: App Package
runs-on: macos-latest
steps:
- name: Setup Environment
Expand All @@ -90,10 +97,48 @@ jobs:
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: bundle exec fastlane build_direct build_number:${{ inputs.build-number }}
run: bundle exec fastlane build_app_package build_number:${{ inputs.build-number }}

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: macos-app-package
path: ${{ github.workspace }}/output

build-disk-image:
name: Disk Image
runs-on: macos-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: macos
appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }}
match-ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }}

- name: Setup Disk Image Creator
run: |
npm install -g create-dmg
brew install graphicsmagick imagemagick
- name: Build LunaSea
working-directory: ${{ github.workspace }}/macos
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ github.workspace }}/keys/appstore.p8
APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MACOS_INSTALLER_CERT_DIRECT: ${{ secrets.MACOS_INSTALLER_CERT_DIRECT }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: bundle exec fastlane build_disk_image build_number:${{ inputs.build-number }} build_version:${{ inputs.build-version }}

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: macos-notarized-package
name: macos-disk-image
path: ${{ github.workspace }}/output
16 changes: 11 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ jobs:
- name: Download Snap
uses: actions/download-artifact@v3
with:
name: linux-snap
name: linux-snapcraft
path: ${{ github.workspace }}/output

- name: Deploy to Snapcraft
run: snapcraft upload --release=${{ inputs.flavor }} ${{ github.workspace }}/output/LunaSea-Linux-amd64.snap

macos-app-store:
macos-appstore:
name: App Store (macOS)
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -227,13 +227,19 @@ jobs:
- name: Download Linux Snap
uses: actions/download-artifact@v3
with:
name: linux-snap
name: linux-snapcraft
path: ${{ github.workspace }}/output

- name: Download macOS Notarized Package
- name: Download macOS App Package
uses: actions/download-artifact@v3
with:
name: macos-notarized-package
name: macos-app-package
path: ${{ github.workspace }}/output

- name: Download macOS Disk Image
uses: actions/download-artifact@v3
with:
name: macos-disk-image
path: ${{ github.workspace }}/output

- name: Upload to S3 Bucket
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
uses: JagandeepBrar/LunaSea/.github/workflows/build_macos.yml@master
with:
build-number: ${{ needs.prepare.outputs.build-number }}
build-version: ${{ needs.prepare.outputs.build-version }}
secrets:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ output/
*.apk
*.aab
*.ipa
*.dmg
*.pkg
*.snap
59 changes: 48 additions & 11 deletions macos/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,48 @@ platform :mac do
)
end

desc "Build App Package for Direct Deployment"
lane :build_app_package do |options|
keychain_create
keychain_setup
connect_appstore_connect

sh(
"flutter", "build", "macos",
"--release",
"--build-number=#{options[:build_number]}",
)
build_mac_app(
scheme: "Runner",
workspace: "Runner.xcworkspace",
installer_cert_name: ENV["MACOS_INSTALLER_CERT_DIRECT"],
export_method: "developer-id",
export_options: {
provisioningProfiles: {
"app.lunasea.lunasea" => "match Direct app.lunasea.lunasea macos",
}
}
)

notarize(
package: "LunaSea.app",
use_notarytool: true,
)
sh("mkdir", "-p", "../../output")
sh("mv", "../LunaSea.app", "../../output/LunaSea.app")
Dir.chdir("../../output") do
sh("zip", "-r", "-y", "LunaSea-macOS.zip", "LunaSea.app")
sh("rm", "-rf", "LunaSea.app")
end

keychain_delete
end

desc "Build App Package for App Store"
lane :build_appstore do |options|
lane :build_app_store do |options|
keychain_create
keychain_setup
connect_appstore_connect

sh(
"flutter", "build", "macos",
Expand All @@ -83,8 +121,8 @@ platform :mac do
keychain_delete
end

desc "Build App Package for Direct Deployment"
lane :build_direct do |options|
desc "Build Disk Image for Direct Deployment"
lane :build_disk_image do |options|
keychain_create
keychain_setup
connect_appstore_connect
Expand All @@ -105,17 +143,16 @@ platform :mac do
}
}
)

Dir.chdir("../") do
sh("create-dmg", "LunaSea.app", "--overwrite")
end
notarize(
package: "LunaSea.app",
package: "LunaSea #{options[:build_version]}.dmg",
bundle_id: "app.lunasea.lunasea.DiskImage",
use_notarytool: true,
)

sh("mkdir", "-p", "../../output")
sh("cp", "-R", "../LunaSea.app", "../../output/LunaSea.app")
Dir.chdir("../../output") do
sh("zip", "-r", "-y", "LunaSea-macOS.zip", "LunaSea.app")
sh("rm", "-rf", "LunaSea.app")
end
sh("mv", "../LunaSea #{options[:build_version]}.dmg", "../../output/LunaSea-macOS.dmg")

keychain_delete
end
Expand Down
26 changes: 21 additions & 5 deletions macos/fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,38 @@ Setup the Keychain

Connect to App Store Connect

### mac build_appstore
### mac build_app_installer

```sh
[bundle exec] fastlane mac build_appstore
[bundle exec] fastlane mac build_app_installer
```

Build App Package for App Store
Build App Installer for Direct Deployment

### mac build_direct
### mac build_app_package

```sh
[bundle exec] fastlane mac build_direct
[bundle exec] fastlane mac build_app_package
```

Build App Package for Direct Deployment

### mac build_app_store

```sh
[bundle exec] fastlane mac build_app_store
```

Build App Package for App Store

### mac build_disk_image

```sh
[bundle exec] fastlane mac build_disk_image
```

Build Disk Image for Direct Deployment

### mac deploy_appstore

```sh
Expand Down

0 comments on commit 8f3a7ab

Please sign in to comment.