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 :
@@ -83,22 +88,26 @@ jobs:
8388 fileDir : ./apps/flipcash/app/key
8489 encodedString : ${{ secrets.UPLOAD_KEY_STORE }}
8590
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-
9591 - name : Cache Gradle
9692 uses : actions/cache@v3
9793 with :
98- path : ~/.gradle/caches
99- key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties') }}
94+ path : |
95+ ~/.gradle/caches
96+ ~/.gradle/wrapper
97+ key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }}
10098 restore-keys : gradle-
10199
100+ - name : Upload Setup Artifacts
101+ uses : actions/upload-artifact@v4
102+ with :
103+ name : setup-files
104+ path : |
105+ ${{ steps.google_services_json_file.outputs.filePath }}
106+ ${{ steps.service_account_json_file.outputs.filePath }}
107+ ${{ steps.signing_key.outputs.filePath }}
108+ code-android-app/apps/flipcash/app/key/key
109+ if-no-files-found : error
110+
102111 tests :
103112 needs : setup
104113 runs-on : ubuntu-latest
@@ -107,74 +116,128 @@ jobs:
107116 with :
108117 fetch-depth : 0
109118
119+ - name : Setup Ruby env
120+ uses : ruby/setup-ruby@v1
121+ with :
122+ ruby-version : 2.7.2
123+ bundler-cache : true
124+
110125 - name : Restore Gradle Cache
111126 uses : actions/cache/restore@v3
112127 with :
113- path : ~/.gradle/caches
114- key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties') }}
128+ path : |
129+ ~/.gradle/caches
130+ ~/.gradle/wrapper
131+ key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }}
115132 restore-keys : gradle-
116133
134+ - name : Download Setup Artifacts
135+ uses : actions/download-artifact@v4
136+ with :
137+ name : setup-files
138+ path : setup-files/
139+
117140 - name : Copy Setup Files
118141 run : |
119142 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
143+ cp ${{ needs.setup.outputs.google_services_json_file }} apps/flipcash/app/src/ || echo "Failed to copy google-services.json"
144+
145+ - name : Setup local.properties
146+ id : local_properties
147+ run : |
148+ cat << EOF > ./local.properties
149+ BUGSNAG_API_KEY="${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}"
150+ GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }}
151+ MIXPANEL_API_KEY="${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}"
152+ EOF
129153
130154 - name : Run tests
131155 run : bundle exec fastlane android flipcash_tests
132156
133- deploy :
157+ build :
134158 needs : setup
135159 runs-on : ubuntu-latest
136160 steps :
137161 - uses : actions/checkout@v4
138162 with :
139163 fetch-depth : 0
140164
165+ - name : Setup Ruby env
166+ uses : ruby/setup-ruby@v1
167+ with :
168+ ruby-version : 2.7.2
169+ bundler-cache : true
170+
141171 - name : Restore Gradle Cache
142172 uses : actions/cache/restore@v3
143173 with :
144- path : ~/.gradle/caches
145- key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties') }}
174+ path : |
175+ ~/.gradle/caches
176+ ~/.gradle/wrapper
177+ key : gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }}
146178 restore-keys : gradle-
147179
180+ - name : Download Setup Artifacts
181+ uses : actions/download-artifact@v4
182+ with :
183+ name : setup-files
184+ path : setup-files/
185+
148186 - name : Copy Setup Files
149187 run : |
150188 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
189+ cp ${{ needs.setup.outputs.google_services_json_file }} apps/flipcash/app/src/ || echo "Failed to copy google-services.json"
190+
191+ - name : Setup local.properties
192+ id : local_properties
193+ run : |
194+ cat << EOF > ./local.properties
195+ BUGSNAG_API_KEY="${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}"
196+ GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }}
197+ MIXPANEL_API_KEY="${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}"
198+ EOF
199+
200+ - name : Build Android release
201+ run : bundle exec fastlane android build_flipcash
163202 env :
164203 STORE_FILE : ${{ needs.setup.outputs.signing_key }}
165204 STORE_PASSWORD : ${{ secrets.KEYSTORE_PASSWORD }}
166205 KEY_ALIAS : ${{ secrets.KEY_ALIAS }}
167206 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 }}
172207
173- - name : Upload build artifacts
208+ - name : Upload Build Artifacts
174209 uses : actions/upload-artifact@v4
175- if : always()
176210 with :
177- name : assets
211+ name : build- assets
178212 path : |
179- ${{ github.workspace }}/apps/flipcash/app/build/outputs/bundle/release
180- ${{ github.workspace }}/apps/flipcash/app/build/outputs/apk/release
213+ ${{ github.workspace }}/artifacts/*.aab
214+ ${{ github.workspace }}/artifacts/*.txt
215+ if-no-files-found : error
216+
217+ deploy :
218+ needs : [tests, build]
219+ runs-on : ubuntu-latest
220+ steps :
221+ - uses : actions/checkout@v4
222+ with :
223+ fetch-depth : 0
224+
225+ - name : Setup Ruby env
226+ uses : ruby/setup-ruby@v1
227+ with :
228+ ruby-version : 2.7.2
229+ bundler-cache : true
230+
231+ - name : Download Build Artifacts
232+ uses : actions/download-artifact@v4
233+ with :
234+ name : build-assets
235+ path : artifacts/
236+
237+ - name : Deploy to Play Store
238+ run : bundle exec fastlane android deploy_to_play_store
239+ env :
240+ SERVICE_ACCOUNT_KEY_JSON : ${{ needs.setup.outputs.service_account_json_file }}
241+ PACKAGE_NAME : com.flipcash.android.app
242+ PLAYSTORE_TRACK : ${{ github.event.inputs.track }}
243+ RELEASE_STATUS : ${{ github.event.inputs.release_status }}
0 commit comments