Skip to content

Commit c5606ee

Browse files
authored
ci: Implement the Android and iOS deployment flow using Fastlane (#2081)
1 parent 19a10f1 commit c5606ee

9 files changed

Lines changed: 476 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Deploy
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy-ios:
10+
name: Build and Deploy iOS
11+
runs-on: macos-latest
12+
timeout-minutes: 45
13+
defaults:
14+
run:
15+
working-directory: example
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: subosito/flutter-action@v2
21+
with:
22+
channel: stable
23+
24+
- uses: ruby/setup-ruby@v1
25+
with:
26+
ruby-version: '3.2'
27+
bundler-cache: true
28+
working-directory: example
29+
30+
- run: flutter pub get
31+
32+
- name: Install CocoaPods
33+
run: cd ios && pod install
34+
35+
- uses: webfactory/ssh-agent@v0.9.0
36+
with:
37+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
38+
39+
- name: Deploy to App Store
40+
run: bundle exec fastlane ios deploy
41+
env:
42+
TEAM_ID: ${{ secrets.TEAM_ID }}
43+
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
44+
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
45+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
46+
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
47+
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
48+
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
49+
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
50+
APPSTORE_KEY_ISSUER_ID: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
51+
APPSTORE_KEY_CONTENT: ${{ secrets.APPSTORE_KEY_CONTENT }}
52+
53+
deploy-android:
54+
name: Build and Deploy Android
55+
runs-on: ubuntu-latest
56+
timeout-minutes: 30
57+
defaults:
58+
run:
59+
working-directory: example
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- uses: actions/setup-java@v4
65+
with:
66+
distribution: 'zulu'
67+
java-version: '17'
68+
69+
- uses: subosito/flutter-action@v2
70+
with:
71+
channel: stable
72+
73+
- run: flutter pub get
74+
75+
- name: Decode keystore
76+
run: echo "${{ secrets.KEY_STORE_BASE64 }}" | base64 --decode > android/app/keystore.jks
77+
78+
- name: Create key.properties
79+
env:
80+
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
81+
KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }}
82+
run: |
83+
printf 'storePassword=%s\n' "$KEY_STORE_PASSWORD" > android/key.properties
84+
printf 'keyPassword=%s\n' "$KEY_STORE_PASSWORD" >> android/key.properties
85+
printf 'keyAlias=%s\n' "$KEY_STORE_ALIAS" >> android/key.properties
86+
printf 'storeFile=keystore.jks\n' >> android/key.properties
87+
88+
- name: Build App Bundle
89+
run: flutter build appbundle --release
90+
91+
- name: Decode service account key
92+
run: echo "${{ secrets.SERVICE_ACCOUNT_FOR_RELEASE_KEY_BASE64 }}" | base64 --decode > service-account-key.json
93+
94+
- name: Upload to Google Play
95+
uses: r0adkll/upload-google-play@v1
96+
with:
97+
serviceAccountJson: example/service-account-key.json
98+
packageName: dev.flchart.app
99+
releaseFiles: example/build/app/outputs/bundle/release/app-release.aab
100+
track: internal
101+
status: draft

example/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,10 @@ app.*.map.json
4444
/android/app/debug
4545
/android/app/profile
4646
/android/app/release
47+
48+
# Fastlane
49+
fastlane/.env
50+
fastlane/report.xml
51+
fastlane/Preview.html
52+
fastlane/screenshots
53+
fastlane/test_output

example/.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.2.8

example/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gem "fastlane"

example/Gemfile.lock

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.8)
5+
abbrev (0.1.2)
6+
addressable (2.9.0)
7+
public_suffix (>= 2.0.2, < 8.0)
8+
artifactory (3.0.17)
9+
atomos (0.1.3)
10+
aws-eventstream (1.4.0)
11+
aws-partitions (1.1238.0)
12+
aws-sdk-core (3.244.0)
13+
aws-eventstream (~> 1, >= 1.3.0)
14+
aws-partitions (~> 1, >= 1.992.0)
15+
aws-sigv4 (~> 1.9)
16+
base64
17+
bigdecimal
18+
jmespath (~> 1, >= 1.6.1)
19+
logger
20+
aws-sdk-kms (1.123.0)
21+
aws-sdk-core (~> 3, >= 3.244.0)
22+
aws-sigv4 (~> 1.5)
23+
aws-sdk-s3 (1.219.0)
24+
aws-sdk-core (~> 3, >= 3.244.0)
25+
aws-sdk-kms (~> 1)
26+
aws-sigv4 (~> 1.5)
27+
aws-sigv4 (1.12.1)
28+
aws-eventstream (~> 1, >= 1.0.2)
29+
babosa (1.0.4)
30+
base64 (0.2.0)
31+
benchmark (0.5.0)
32+
bigdecimal (4.1.1)
33+
claide (1.1.0)
34+
colored (1.2)
35+
colored2 (3.1.2)
36+
commander (4.6.0)
37+
highline (~> 2.0.0)
38+
csv (3.3.5)
39+
declarative (0.0.20)
40+
digest-crc (0.7.0)
41+
rake (>= 12.0.0, < 14.0.0)
42+
domain_name (0.6.20240107)
43+
dotenv (2.8.1)
44+
emoji_regex (3.2.3)
45+
excon (0.112.0)
46+
faraday (1.10.5)
47+
faraday-em_http (~> 1.0)
48+
faraday-em_synchrony (~> 1.0)
49+
faraday-excon (~> 1.1)
50+
faraday-httpclient (~> 1.0)
51+
faraday-multipart (~> 1.0)
52+
faraday-net_http (~> 1.0)
53+
faraday-net_http_persistent (~> 1.0)
54+
faraday-patron (~> 1.0)
55+
faraday-rack (~> 1.0)
56+
faraday-retry (~> 1.0)
57+
ruby2_keywords (>= 0.0.4)
58+
faraday-cookie_jar (0.0.8)
59+
faraday (>= 0.8.0)
60+
http-cookie (>= 1.0.0)
61+
faraday-em_http (1.0.0)
62+
faraday-em_synchrony (1.0.1)
63+
faraday-excon (1.1.0)
64+
faraday-httpclient (1.0.1)
65+
faraday-multipart (1.2.0)
66+
multipart-post (~> 2.0)
67+
faraday-net_http (1.0.2)
68+
faraday-net_http_persistent (1.2.0)
69+
faraday-patron (1.0.0)
70+
faraday-rack (1.0.0)
71+
faraday-retry (1.0.4)
72+
faraday_middleware (1.2.1)
73+
faraday (~> 1.0)
74+
fastimage (2.4.1)
75+
fastlane (2.232.2)
76+
CFPropertyList (>= 2.3, < 4.0.0)
77+
abbrev (~> 0.1.2)
78+
addressable (>= 2.8, < 3.0.0)
79+
artifactory (~> 3.0)
80+
aws-sdk-s3 (~> 1.197)
81+
babosa (>= 1.0.3, < 2.0.0)
82+
base64 (~> 0.2.0)
83+
benchmark (>= 0.1.0)
84+
bundler (>= 1.17.3, < 5.0.0)
85+
colored (~> 1.2)
86+
commander (~> 4.6)
87+
csv (~> 3.3)
88+
dotenv (>= 2.1.1, < 3.0.0)
89+
emoji_regex (>= 0.1, < 4.0)
90+
excon (>= 0.71.0, < 1.0.0)
91+
faraday (~> 1.0)
92+
faraday-cookie_jar (~> 0.0.6)
93+
faraday_middleware (~> 1.0)
94+
fastimage (>= 2.1.0, < 3.0.0)
95+
fastlane-sirp (>= 1.0.0)
96+
gh_inspector (>= 1.1.2, < 2.0.0)
97+
google-apis-androidpublisher_v3 (~> 0.3)
98+
google-apis-playcustomapp_v1 (~> 0.1)
99+
google-cloud-env (>= 1.6.0, <= 2.1.1)
100+
google-cloud-storage (~> 1.31)
101+
highline (~> 2.0)
102+
http-cookie (~> 1.0.5)
103+
json (< 3.0.0)
104+
jwt (>= 2.1.0, < 3)
105+
logger (>= 1.6, < 2.0)
106+
mini_magick (>= 4.9.4, < 5.0.0)
107+
multipart-post (>= 2.0.0, < 3.0.0)
108+
mutex_m (~> 0.3.0)
109+
naturally (~> 2.2)
110+
nkf (~> 0.2.0)
111+
optparse (>= 0.1.1, < 1.0.0)
112+
ostruct (>= 0.1.0)
113+
plist (>= 3.1.0, < 4.0.0)
114+
rubyzip (>= 2.0.0, < 3.0.0)
115+
security (= 0.1.5)
116+
simctl (~> 1.6.3)
117+
terminal-notifier (>= 2.0.0, < 3.0.0)
118+
terminal-table (~> 3)
119+
tty-screen (>= 0.6.3, < 1.0.0)
120+
tty-spinner (>= 0.8.0, < 1.0.0)
121+
word_wrap (~> 1.0.0)
122+
xcodeproj (>= 1.13.0, < 2.0.0)
123+
xcpretty (~> 0.4.1)
124+
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
125+
fastlane-sirp (1.0.0)
126+
sysrandom (~> 1.0)
127+
gh_inspector (1.1.3)
128+
google-apis-androidpublisher_v3 (0.98.0)
129+
google-apis-core (>= 0.15.0, < 2.a)
130+
google-apis-core (0.18.0)
131+
addressable (~> 2.5, >= 2.5.1)
132+
googleauth (~> 1.9)
133+
httpclient (>= 2.8.3, < 3.a)
134+
mini_mime (~> 1.0)
135+
mutex_m
136+
representable (~> 3.0)
137+
retriable (>= 2.0, < 4.a)
138+
google-apis-iamcredentials_v1 (0.26.0)
139+
google-apis-core (>= 0.15.0, < 2.a)
140+
google-apis-playcustomapp_v1 (0.17.0)
141+
google-apis-core (>= 0.15.0, < 2.a)
142+
google-apis-storage_v1 (0.61.0)
143+
google-apis-core (>= 0.15.0, < 2.a)
144+
google-cloud-core (1.8.0)
145+
google-cloud-env (>= 1.0, < 3.a)
146+
google-cloud-errors (~> 1.0)
147+
google-cloud-env (2.1.1)
148+
faraday (>= 1.0, < 3.a)
149+
google-cloud-errors (1.6.0)
150+
google-cloud-storage (1.59.0)
151+
addressable (~> 2.8)
152+
digest-crc (~> 0.4)
153+
google-apis-core (>= 0.18, < 2)
154+
google-apis-iamcredentials_v1 (~> 0.18)
155+
google-apis-storage_v1 (>= 0.42)
156+
google-cloud-core (~> 1.6)
157+
googleauth (~> 1.9)
158+
mini_mime (~> 1.0)
159+
googleauth (1.11.2)
160+
faraday (>= 1.0, < 3.a)
161+
google-cloud-env (~> 2.1)
162+
jwt (>= 1.4, < 3.0)
163+
multi_json (~> 1.11)
164+
os (>= 0.9, < 2.0)
165+
signet (>= 0.16, < 2.a)
166+
highline (2.0.3)
167+
http-cookie (1.0.8)
168+
domain_name (~> 0.5)
169+
httpclient (2.9.0)
170+
mutex_m
171+
jmespath (1.6.2)
172+
json (2.19.3)
173+
jwt (2.10.2)
174+
base64
175+
logger (1.7.0)
176+
mini_magick (4.13.2)
177+
mini_mime (1.1.5)
178+
multi_json (1.20.1)
179+
multipart-post (2.4.1)
180+
mutex_m (0.3.0)
181+
nanaimo (0.4.0)
182+
naturally (2.3.0)
183+
nkf (0.2.0)
184+
optparse (0.8.1)
185+
os (1.1.4)
186+
ostruct (0.6.3)
187+
plist (3.7.2)
188+
public_suffix (7.0.5)
189+
rake (13.4.1)
190+
representable (3.2.0)
191+
declarative (< 0.1.0)
192+
trailblazer-option (>= 0.1.1, < 0.2.0)
193+
uber (< 0.2.0)
194+
retriable (3.4.1)
195+
rexml (3.4.4)
196+
rouge (3.28.0)
197+
ruby2_keywords (0.0.5)
198+
rubyzip (2.4.1)
199+
security (0.1.5)
200+
signet (0.21.0)
201+
addressable (~> 2.8)
202+
faraday (>= 0.17.5, < 3.a)
203+
jwt (>= 1.5, < 4.0)
204+
multi_json (~> 1.10)
205+
simctl (1.6.10)
206+
CFPropertyList
207+
naturally
208+
sysrandom (1.0.5)
209+
terminal-notifier (2.0.0)
210+
terminal-table (3.0.2)
211+
unicode-display_width (>= 1.1.1, < 3)
212+
trailblazer-option (0.1.2)
213+
tty-cursor (0.7.1)
214+
tty-screen (0.8.2)
215+
tty-spinner (0.9.3)
216+
tty-cursor (~> 0.7)
217+
uber (0.1.0)
218+
unicode-display_width (2.6.0)
219+
word_wrap (1.0.0)
220+
xcodeproj (1.27.0)
221+
CFPropertyList (>= 2.3.3, < 4.0)
222+
atomos (~> 0.1.3)
223+
claide (>= 1.0.2, < 2.0)
224+
colored2 (~> 3.1)
225+
nanaimo (~> 0.4.0)
226+
rexml (>= 3.3.6, < 4.0)
227+
xcpretty (0.4.1)
228+
rouge (~> 3.28.0)
229+
xcpretty-travis-formatter (1.0.1)
230+
xcpretty (~> 0.2, >= 0.0.7)
231+
232+
PLATFORMS
233+
arm64-darwin-23
234+
arm64-darwin-25
235+
236+
DEPENDENCIES
237+
fastlane
238+
239+
BUNDLED WITH
240+
2.4.22

example/fastlane/Appfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
app_identifier("dev.flchart.app")
2+
apple_id(ENV["FASTLANE_USER"])
3+
itc_team_id(ENV["ITC_TEAM_ID"])
4+
team_id(ENV["TEAM_ID"])

0 commit comments

Comments
 (0)