Skip to content

Commit d013167

Browse files
authored
ci: MacOS store deployment (#2085)
1 parent c5606ee commit d013167

6 files changed

Lines changed: 159 additions & 4 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
4949
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
5050
APPSTORE_KEY_ISSUER_ID: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
51-
APPSTORE_KEY_CONTENT: ${{ secrets.APPSTORE_KEY_CONTENT }}
51+
APPSTORE_KEY_CONTENT_BASE64: ${{ secrets.APPSTORE_KEY_CONTENT_BASE64 }}
5252

5353
deploy-android:
5454
name: Build and Deploy Android
@@ -99,3 +99,47 @@ jobs:
9999
releaseFiles: example/build/app/outputs/bundle/release/app-release.aab
100100
track: internal
101101
status: draft
102+
103+
deploy-macos:
104+
name: Build and Deploy macOS
105+
runs-on: macos-latest
106+
timeout-minutes: 45
107+
defaults:
108+
run:
109+
working-directory: example
110+
111+
steps:
112+
- uses: actions/checkout@v4
113+
114+
- uses: subosito/flutter-action@v2
115+
with:
116+
channel: stable
117+
118+
- uses: ruby/setup-ruby@v1
119+
with:
120+
ruby-version: '3.2'
121+
bundler-cache: true
122+
working-directory: example
123+
124+
- run: flutter pub get
125+
126+
- name: Build macOS app
127+
run: flutter build macos --release
128+
129+
- uses: webfactory/ssh-agent@v0.9.0
130+
with:
131+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
132+
133+
- name: Deploy to Mac App Store
134+
run: bundle exec fastlane mac deploy
135+
env:
136+
TEAM_ID: ${{ secrets.TEAM_ID }}
137+
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
138+
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
139+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
140+
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
141+
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
142+
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
143+
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
144+
APPSTORE_KEY_ISSUER_ID: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
145+
APPSTORE_KEY_CONTENT_BASE64: ${{ secrets.APPSTORE_KEY_CONTENT_BASE64 }}

example/fastlane/Fastfile

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ platform :ios do
66
app_store_connect_api_key(
77
key_id: ENV["APPSTORE_KEY_ID"],
88
issuer_id: ENV["APPSTORE_KEY_ISSUER_ID"],
9-
key_content: ENV["APPSTORE_KEY_CONTENT"],
9+
key_content: ENV["APPSTORE_KEY_CONTENT_BASE64"],
1010
is_key_content_base64: true,
1111
)
1212

@@ -21,7 +21,8 @@ platform :ios do
2121
app_store_connect_api_key(
2222
key_id: ENV["APPSTORE_KEY_ID"],
2323
issuer_id: ENV["APPSTORE_KEY_ISSUER_ID"],
24-
key_content: ENV["APPSTORE_KEY_CONTENT"],
24+
key_content: ENV["APPSTORE_KEY_CONTENT_BASE64"],
25+
is_key_content_base64: true,
2526
)
2627

2728
if is_ci
@@ -73,3 +74,86 @@ platform :ios do
7374
)
7475
end
7576
end
77+
78+
platform :mac do
79+
desc "Sync certificates and provisioning profiles for macOS"
80+
lane :sync_certificates do
81+
app_store_connect_api_key(
82+
key_id: ENV["APPSTORE_KEY_ID"],
83+
issuer_id: ENV["APPSTORE_KEY_ISSUER_ID"],
84+
key_content: ENV["APPSTORE_KEY_CONTENT_BASE64"],
85+
is_key_content_base64: true,
86+
)
87+
88+
match(
89+
type: "appstore",
90+
platform: "macos",
91+
additional_cert_types: ["mac_installer_distribution"],
92+
)
93+
end
94+
95+
desc "Deploy to Mac App Store"
96+
lane :deploy do
97+
keychain_name = ENV["MATCH_KEYCHAIN_NAME"]
98+
keychain_password = ENV["MATCH_KEYCHAIN_PASSWORD"]
99+
100+
app_store_connect_api_key(
101+
key_id: ENV["APPSTORE_KEY_ID"],
102+
issuer_id: ENV["APPSTORE_KEY_ISSUER_ID"],
103+
key_content: ENV["APPSTORE_KEY_CONTENT_BASE64"],
104+
is_key_content_base64: true,
105+
)
106+
107+
if is_ci
108+
delete_keychain(
109+
name: keychain_name
110+
) if File.exist? File.expand_path("~/Library/Keychains/#{keychain_name}-db")
111+
create_keychain(
112+
name: keychain_name,
113+
password: keychain_password,
114+
default_keychain: true,
115+
unlock: true,
116+
timeout: 3600,
117+
lock_when_sleeps: false,
118+
require_create: true,
119+
)
120+
end
121+
122+
match(
123+
type: "appstore",
124+
platform: "macos",
125+
additional_cert_types: ["mac_installer_distribution"],
126+
readonly: is_ci,
127+
keychain_name: keychain_name,
128+
keychain_password: keychain_password,
129+
)
130+
131+
update_code_signing_settings(
132+
use_automatic_signing: false,
133+
path: "macos/Runner.xcodeproj",
134+
team_id: ENV["TEAM_ID"],
135+
bundle_identifier: "dev.flchart.app",
136+
profile_name: "match AppStore dev.flchart.app macos",
137+
code_sign_identity: "Apple Distribution",
138+
)
139+
140+
build_app(
141+
workspace: "macos/Runner.xcworkspace",
142+
scheme: "Runner",
143+
export_method: "app-store",
144+
destination: "generic/platform=macOS",
145+
export_options: {
146+
provisioningProfiles: {
147+
"dev.flchart.app" => "match AppStore dev.flchart.app macos"
148+
}
149+
}
150+
)
151+
152+
upload_to_app_store(
153+
skip_metadata: true,
154+
skip_screenshots: true,
155+
precheck_include_in_app_purchases: false,
156+
platform: "osx",
157+
)
158+
end
159+
end

example/fastlane/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ Deploy to App Store
3333

3434
----
3535

36+
37+
## Mac
38+
39+
### mac sync_certificates
40+
41+
```sh
42+
[bundle exec] fastlane mac sync_certificates
43+
```
44+
45+
Sync certificates and provisioning profiles for macOS
46+
47+
### mac deploy
48+
49+
```sh
50+
[bundle exec] fastlane mac deploy
51+
```
52+
53+
Deploy to Mac App Store
54+
55+
----
56+
3657
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
3758

3859
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).

example/ios/Runner/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
<true/>
5252
<key>UILaunchStoryboardName</key>
5353
<string>LaunchScreen</string>
54+
<key>ITSAppUsesNonExemptEncryption</key>
55+
<false/>
5456
<key>UIMainStoryboardFile</key>
5557
<string>Main</string>
5658
<key>UISupportedInterfaceOrientations</key>

example/macos/Runner/Configs/AppInfo.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
PRODUCT_NAME = FL Chart App
99

1010
// The application's bundle identifier
11-
PRODUCT_BUNDLE_IDENTIFIER = dev.flchart.app.exampleNew
11+
PRODUCT_BUNDLE_IDENTIFIER = dev.flchart.app
1212

1313
// The copyright displayed in application information
1414
PRODUCT_COPYRIGHT = Copyright © 2025 dev.flchart.app. All rights reserved.

example/macos/Runner/Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2525
<key>NSHumanReadableCopyright</key>
2626
<string>$(PRODUCT_COPYRIGHT)</string>
27+
<key>ITSAppUsesNonExemptEncryption</key>
28+
<false/>
29+
<key>LSApplicationCategoryType</key>
30+
<string>public.app-category.developer-tools</string>
2731
<key>NSMainNibFile</key>
2832
<string>MainMenu</string>
2933
<key>NSPrincipalClass</key>

0 commit comments

Comments
 (0)