44 main_project_module : apps:flipcash:app
55 playstore_name : Flipcash
66
7+ # Cancel in-progress workflow runs if a job fails
8+ concurrency :
9+ group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.inputs.track }}-${{ github.event.inputs.release_status }}
10+ cancel-in-progress : true
11+
712on :
813 workflow_dispatch :
914 inputs :
3237 setup :
3338 runs-on : ubuntu-latest
3439 outputs :
35- google_services_json : ${{ steps.google_services_json_file.outputs.filePath }}
3640 service_account_json : ${{ steps.service_account_json_file.outputs.filePath }}
3741 signing_key : ${{ steps.signing_key.outputs.filePath }}
3842 steps :
5357 ruby-version : 2.7.2
5458 bundler-cache : true
5559
56- - name : Decode Google Services JSON file
57- uses : timheuer/base64-to-file@v1
58- id : google_services_json_file
59- with :
60- fileName : google-services.json
61- fileDir : ./apps/flipcash/app/src
62- encodedString : ${{ secrets.FLIPCASH_GOOGLE_SERVICES_JSON }}
63-
6460 - name : Decode Service Account Key JSON file
6561 uses : timheuer/base64-to-file@v1
6662 id : service_account_json_file
@@ -83,20 +79,13 @@ jobs:
8379 fileDir : ./apps/flipcash/app/key
8480 encodedString : ${{ secrets.UPLOAD_KEY_STORE }}
8581
86- - name : Setup BugSnag API Key
87- run : echo BUGSNAG_API_KEY=\"${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}\" > ./local.properties
88-
89- - name : Setup Google Cloud Project Number
90- run : echo GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }} >> ./local.properties
91-
92- - name : Setup Mixpanel API Key
93- run : echo MIXPANEL_API_KEY=\"${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}\" >> ./local.properties
94-
9582 - name : Cache Gradle
9683 uses : actions/cache@v3
9784 with :
98- path : ~/.gradle/caches
99- key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties') }}
85+ path : |
86+ ~/.gradle/caches
87+ ~/.gradle/wrapper
88+ key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }}
10089 restore-keys : gradle-
10190
10291 tests :
@@ -107,74 +96,122 @@ jobs:
10796 with :
10897 fetch-depth : 0
10998
99+ - name : Setup Ruby env
100+ uses : ruby/setup-ruby@v1
101+ with :
102+ ruby-version : 2.7.2
103+ bundler-cache : true
104+
110105 - name : Restore Gradle Cache
111106 uses : actions/cache/restore@v3
112107 with :
113- path : ~/.gradle/caches
114- key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties') }}
108+ path : |
109+ ~/.gradle/caches
110+ ~/.gradle/wrapper
111+ key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }}
115112 restore-keys : gradle-
116113
117- - name : Copy Setup Files
114+ - name : Decode Google Services JSON file
115+ uses : timheuer/base64-to-file@v1
116+ id : google_services_json_file
117+ with :
118+ fileName : google-services.json
119+ fileDir : ./apps/flipcash/app/src
120+ encodedString : ${{ secrets.FLIPCASH_GOOGLE_SERVICES_JSON }}
121+
122+ - name : Setup local.properties
123+ id : local_properties
118124 run : |
119- mkdir -p ./apps/flipcash/app/src
120- mkdir -p ./key
121- mkdir -p ./apps/flipcash/app/key
122- cp ${{ needs.setup.outputs.google_services_json }} ./apps/flipcash/app/src/google-services.json
123- cp ${{ needs.setup.outputs.service_account_json }} ./serviceAccount.json
124- cp ${{ needs.setup.outputs.signing_key }} ./key/key
125- cp ${{ needs.setup.outputs.signing_key }} ./apps/flipcash/app/key/key
126- echo BUGSNAG_API_KEY=\"${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}\" > ./local.properties
127- echo GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }} >> ./local.properties
128- echo MIXPANEL_API_KEY=\"${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}\" >> ./local.properties
125+ cat << EOF > ./local.properties
126+ BUGSNAG_API_KEY="${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}"
127+ GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }}
128+ MIXPANEL_API_KEY="${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}"
129+ EOF
129130
130131 - name : Run tests
131132 run : bundle exec fastlane android flipcash_tests
132133
133- deploy :
134+ build :
134135 needs : setup
135136 runs-on : ubuntu-latest
136137 steps :
137138 - uses : actions/checkout@v4
138139 with :
139140 fetch-depth : 0
140141
142+ - name : Setup Ruby env
143+ uses : ruby/setup-ruby@v1
144+ with :
145+ ruby-version : 2.7.2
146+ bundler-cache : true
147+
141148 - name : Restore Gradle Cache
142149 uses : actions/cache/restore@v3
143150 with :
144- path : ~/.gradle/caches
145- key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties') }}
151+ path : |
152+ ~/.gradle/caches
153+ ~/.gradle/wrapper
154+ key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }}
146155 restore-keys : gradle-
147156
148- - name : Copy Setup Files
157+ - name : Decode Google Services JSON file
158+ uses : timheuer/base64-to-file@v1
159+ id : google_services_json_file
160+ with :
161+ fileName : google-services.json
162+ fileDir : ./apps/flipcash/app/src
163+ encodedString : ${{ secrets.FLIPCASH_GOOGLE_SERVICES_JSON }}
164+
165+ - name : Setup local.properties
166+ id : local_properties
149167 run : |
150- mkdir -p ./apps/flipcash/app/src
151- mkdir -p ./key
152- mkdir -p ./apps/flipcash/app/key
153- cp ${{ needs.setup.outputs.google_services_json }} ./apps/flipcash/app/src/google-services.json
154- cp ${{ needs.setup.outputs.service_account_json }} ./serviceAccount.json
155- cp ${{ needs.setup.outputs.signing_key }} ./key/key
156- cp ${{ needs.setup.outputs.signing_key }} ./apps/flipcash/app/key/key
157- echo BUGSNAG_API_KEY=\"${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}\" > ./local.properties
158- echo GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }} >> ./local.properties
159- echo MIXPANEL_API_KEY=\"${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}\" >> ./local.properties
160-
161- - name : Build & deploy Android release
162- run : bundle exec fastlane android deploy_flipcash
168+ cat << EOF > ./local.properties
169+ BUGSNAG_API_KEY="${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}"
170+ GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }}
171+ MIXPANEL_API_KEY="${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}"
172+ EOF
173+
174+ - name : Build Android release
175+ run : bundle exec fastlane android build_flipcash
163176 env :
164177 STORE_FILE : ${{ needs.setup.outputs.signing_key }}
165178 STORE_PASSWORD : ${{ secrets.KEYSTORE_PASSWORD }}
166179 KEY_ALIAS : ${{ secrets.KEY_ALIAS }}
167180 KEY_PASSWORD : ${{ secrets.KEYSTORE_PASSWORD }}
168- SERVICE_ACCOUNT_KEY_JSON : ${{ needs.setup.outputs.service_account_json }}
169- PACKAGE_NAME : com.flipcash.android.app
170- PLAYSTORE_TRACK : ${{ github.event.inputs.track }}
171- RELEASE_STATUS : ${{ github.event.inputs.release_status }}
172181
173- - name : Upload build artifacts
182+ - name : Upload Build Artifacts
174183 uses : actions/upload-artifact@v4
175- if : always()
176184 with :
177- name : assets
185+ name : build- assets
178186 path : |
179- ${{ github.workspace }}/apps/flipcash/app/build/outputs/bundle/release
180- ${{ github.workspace }}/apps/flipcash/app/build/outputs/apk/release
187+ ${{ github.workspace }}/artifacts/*.aab
188+ ${{ github.workspace }}/artifacts/*.txt
189+ if-no-files-found : error
190+
191+ deploy :
192+ needs : [tests, build]
193+ runs-on : ubuntu-latest
194+ steps :
195+ - uses : actions/checkout@v4
196+ with :
197+ fetch-depth : 0
198+
199+ - name : Setup Ruby env
200+ uses : ruby/setup-ruby@v1
201+ with :
202+ ruby-version : 2.7.2
203+ bundler-cache : true
204+
205+ - name : Download Build Artifacts
206+ uses : actions/download-artifact@v4
207+ with :
208+ name : build-assets
209+ path : artifacts/
210+
211+ - name : Deploy to Play Store
212+ run : bundle exec fastlane android deploy_to_play_store
213+ env :
214+ SERVICE_ACCOUNT_KEY_JSON : ${{ needs.setup.outputs.service_account_json }}
215+ PACKAGE_NAME : com.flipcash.android.app
216+ PLAYSTORE_TRACK : ${{ github.event.inputs.track }}
217+ RELEASE_STATUS : ${{ github.event.inputs.release_status }}
0 commit comments