Skip to content

Commit 4ae1eb4

Browse files
committed
build: add fcash2 CI
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 2b84f82 commit 4ae1eb4

2 files changed

Lines changed: 183 additions & 0 deletions

File tree

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Flipcash2 Build and Deploy
2+
3+
env:
4+
# The name of the main module repository
5+
main_project_module: apps:flipcash:app2
6+
7+
# The name of the Play Store
8+
playstore_name: Flipcash
9+
10+
on:
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
inputs:
14+
track:
15+
description: 'Define PlayStore track name'
16+
required: true
17+
default: 'internal'
18+
type: choice
19+
options:
20+
- internal
21+
- alpha
22+
- beta
23+
- production
24+
25+
release_status:
26+
description: 'Status of the release'
27+
required: true
28+
type: choice
29+
default: 'completed'
30+
options:
31+
- completed
32+
- draft
33+
- inProgress
34+
- halted
35+
36+
jobs:
37+
deploy:
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Setup Java env
46+
uses: actions/setup-java@v3
47+
with:
48+
java-version: '21'
49+
distribution: 'corretto'
50+
cache: 'gradle'
51+
52+
- name: Setup Ruby env
53+
uses: ruby/setup-ruby@v1
54+
with:
55+
ruby-version: 2.7.2
56+
bundler-cache: true
57+
58+
- name: Decode Google Services JSON file
59+
uses: timheuer/base64-to-file@v1
60+
id: google_services_json_file
61+
with:
62+
fileName: google-services.json
63+
fileDir: ./apps/flipcash/app2/src
64+
encodedString: ${{ secrets.FLIPCASH2_GOOGLE_SERVICES }}
65+
66+
- name: Decode Service Account Key JSON file
67+
uses: timheuer/base64-to-file@v1
68+
id: service_account_json_file
69+
with:
70+
fileName: serviceAccount.json
71+
encodedString: ${{ secrets.FLIPCASH_SERVICE_ACCOUNT_KEY_JSON }}
72+
73+
- name: Decode Upload Key Store file into location 1
74+
uses: timheuer/base64-to-file@v1
75+
id: signing_key
76+
with:
77+
fileName: key
78+
fileDir: ./key
79+
encodedString: ${{ secrets.UPLOAD_KEY_STORE }}
80+
81+
- name: Decode Upload Key Store file into location 2
82+
uses: timheuer/base64-to-file@v1
83+
with:
84+
fileName: key
85+
fileDir: ./apps/flipcash/app2/key
86+
encodedString: ${{ secrets.UPLOAD_KEY_STORE }}
87+
88+
- name: Setup BugSnag API Key
89+
run: echo BUGSNAG_API_KEY=\"${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}\" > ./local.properties
90+
91+
- name: Setup Google Cloud Project Number
92+
run: echo GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }} >> ./local.properties
93+
94+
- name: Setup Mixpanel API Key
95+
run: echo MIXPANEL_API_KEY=\"${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}\" >> ./local.properties
96+
97+
- name: Run tests
98+
run: bundle exec fastlane android flipcash_tests
99+
100+
- name: Build & deploy Android release
101+
run: bundle exec fastlane android deploy_flipcash2
102+
env:
103+
STORE_FILE: ${{ steps.signing_key.outputs.filePath }}
104+
STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
105+
KEY_ALIAS: ${{ secrets.KEY_ALIAS}}
106+
KEY_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
107+
SERVICE_ACCOUNT_KEY_JSON: ${{ steps.service_account_json_file.outputs.filePath }}
108+
PACKAGE_NAME: com.flipcash.android.app
109+
PLAYSTORE_TRACK: ${{ github.event.inputs.track }}
110+
RELEASE_STATUS: ${{ github.event.inputs.release_status }}
111+
112+
- name: Upload build artifacts
113+
uses: actions/upload-artifact@v4
114+
if: always()
115+
with:
116+
name: assets
117+
path: |
118+
${{ github.workspace }}/apps/flipcash/app2/build/outputs/bundle/release
119+
${{ github.workspace }}/apps/flipcash/app2/build/outputs/apk/release

fastlane/Fastfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,70 @@ desc "Build and Deploy a new version of Flipcash to the Google Play Store"
178178
)
179179
end
180180

181+
desc "Build and Deploy a new version of Flipcash2 to the Google Play Store"
182+
lane :deploy_flipcash2 do
183+
gradle(
184+
task: "clean apps:flipcash:app2:bundle", #"clean app:bundleRelease",
185+
build_type: "release",
186+
properties: {
187+
#"versionPatch" => ENV["BUILD_NUMBER"],
188+
"android.injected.signing.store.file" => ENV["STORE_FILE"],
189+
"android.injected.signing.store.password" => ENV["STORE_PASSWORD"],
190+
"android.injected.signing.key.alias" => ENV["KEY_ALIAS"],
191+
"android.injected.signing.key.password" => ENV["KEY_PASSWORD"]
192+
}
193+
)
194+
195+
bundletool(
196+
ks_path: ENV["STORE_FILE"],
197+
ks_password: ENV["STORE_PASSWORD"],
198+
ks_key_alias: ENV["KEY_ALIAS"],
199+
ks_key_alias_password: ENV["KEY_PASSWORD"],
200+
bundletool_version: '1.10.0',
201+
aab_path: Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
202+
apk_output_path: "apps/flipcash/app2/build/outputs/apk/release",
203+
verbose: true,
204+
)
205+
206+
validate_play_store_json_key(
207+
json_key: ENV["SERVICE_ACCOUNT_KEY_JSON"]
208+
)
209+
210+
upload_to_play_store(
211+
track: ENV["PLAYSTORE_TRACK"],
212+
release_status: ENV["RELEASE_STATUS"],
213+
aab: Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
214+
skip_upload_apk: true,
215+
skip_upload_changelogs: true,
216+
skip_upload_images: true,
217+
package_name: ENV["PACKAGE_NAME"],
218+
mapping: Actions.lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH]
219+
# mapping: mapping_file_exists() ? Actions.lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH] : nil
220+
)
221+
222+
# gradle(
223+
# task: "apps:flipcash:app:bugsnagUploadReleaseBundle",
224+
# properties: {
225+
# #"versionPatch" => ENV["BUILD_NUMBER"],
226+
# "android.injected.signing.store.file" => ENV["STORE_FILE"],
227+
# "android.injected.signing.store.password" => ENV["STORE_PASSWORD"],
228+
# "android.injected.signing.key.alias" => ENV["KEY_ALIAS"],
229+
# "android.injected.signing.key.password" => ENV["KEY_PASSWORD"]
230+
# }
231+
# )
232+
233+
gradle(
234+
task: "apps:flipcash:app2:bugsnagUploadReleaseProguardMapping",
235+
properties: {
236+
#"versionPatch" => ENV["BUILD_NUMBER"],
237+
"android.injected.signing.store.file" => ENV["STORE_FILE"],
238+
"android.injected.signing.store.password" => ENV["STORE_PASSWORD"],
239+
"android.injected.signing.key.alias" => ENV["KEY_ALIAS"],
240+
"android.injected.signing.key.password" => ENV["KEY_PASSWORD"]
241+
}
242+
)
243+
end
244+
181245
desc "Download store metadata for Flipcash"
182246
lane :download_from_playstore_flipcash do
183247
download_from_play_store(

0 commit comments

Comments
 (0)