11name : release-android-base
22
33permissions :
4+ id-token : write
45 contents : read
56
67on :
1819 description : ' Release type of the project (debug/internal/production)'
1920 default : ' internal'
2021 type : string
22+ project-type :
23+ description : ' Type of project (wallet/dapp)'
24+ required : true
25+ type : string
2126 output-path :
2227 description : ' Path to get the APK file'
2328 required : true
4550 required : true
4651 google-services-file :
4752 required : false
53+ aws-account-id :
54+ required : true
55+ slack-webhook-url :
56+ required : true
57+ firebase-url :
58+ description : ' Firebase URL of the project'
59+ required : false
4860
4961jobs :
5062 build :
@@ -90,16 +102,18 @@ jobs:
90102 echo "org.gradle.caching=true" >> ${{ inputs.root-path }}/android/gradle.properties
91103
92104 - name : Cache Gradle
93- uses : actions/cache@v3
105+ uses : actions/cache@v4
94106 with :
95107 path : |
96108 ~/.gradle/caches
97109 ~/.gradle/wrapper
98- key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
110+ ${{ inputs.root-path }}/android/.gradle
111+ key : ${{ runner.os }}-gradle-${{ inputs.name }}-${{ hashFiles(format('{0}/android/**/*.gradle*', inputs.root-path), format('{0}/android/**/gradle-wrapper.properties', inputs.root-path)) }}
99112 restore-keys : |
100- ${{ runner.os }}-gradle-
113+ ${{ runner.os }}-gradle-${{ inputs.name }}-
101114
102115 - name : Build APK
116+ id : build
103117 run : |
104118 if [ ${{ inputs.release-type }} = 'internal' ]; then
105119 cd ${{ inputs.root-path }} && yarn install && yarn run android:build:internal
@@ -113,9 +127,80 @@ jobs:
113127 tools-version : 13.0.1
114128 gcp_sa_key : ${{ secrets.gsa-key }}
115129
116- - name : Upload APK
130+ - name : Upload APK to Firebase
131+ id : firebase-upload
132+ continue-on-error : false
117133 env :
118134 APP_ID : ${{ secrets.firebase-app-id }}
119135 run : |
120- firebase appdistribution:distribute ${{ inputs.output-path }} --app $APP_ID --release-notes "${{ inputs.name }} ${{ inputs.release-type }} release" --groups "flutter-team, javascript-team, kotlin-team, unity, rust-team, swift-team, wc-testers"
121-
136+ firebase appdistribution:distribute ${{ inputs.output-path }} \
137+ --app $APP_ID \
138+ --release-notes "${{ inputs.name }} (${{ inputs.project-type }}) - ${{ inputs.release-type }} - Branch: ${{ github.ref_name }}" \
139+ --groups "flutter-team, javascript-team, kotlin-team, unity, rust-team, swift-team, wc-testers"
140+
141+ - name : Configure AWS credentials
142+ id : aws-creds
143+ continue-on-error : true
144+ uses : aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8
145+ with :
146+ role-to-assume : arn:aws:iam::${{ secrets.aws-account-id }}:role/prod-github-actions-react-native-builds
147+ aws-region : eu-central-1
148+ output-env-credentials : false
149+ output-credentials : true
150+
151+ - name : Upload Android build to S3
152+ id : s3-upload
153+ env :
154+ AWS_REGION : eu-central-1
155+ AWS_ACCESS_KEY_ID : ${{ steps.aws-creds.outputs.aws-access-key-id }}
156+ AWS_SECRET_ACCESS_KEY : ${{ steps.aws-creds.outputs.aws-secret-access-key }}
157+ AWS_SESSION_TOKEN : ${{ steps.aws-creds.outputs.aws-session-token }}
158+ continue-on-error : true
159+ run : |
160+ aws s3 cp \
161+ ${{ inputs.output-path }} \
162+ s3://walletconnect.react-native-builds.prod/android/${{ inputs.release-type }}/${{ inputs.project-type }}-${{ inputs.release-type }}.apk
163+
164+ - name : Send Slack notification
165+ if : always() && !cancelled()
166+ 167+ with :
168+ webhook : ${{ secrets.slack-webhook-url }}
169+ webhook-type : incoming-webhook
170+ payload : |
171+ {
172+ "text": "Android Build Report - ${{ inputs.name }} - ${{ inputs.release-type }}",
173+ "blocks": [
174+ {
175+ "type": "header",
176+ "text": { "type": "plain_text", "text": "🤖 Android Build Report" }
177+ },
178+ {
179+ "type": "section",
180+ "fields": [
181+ { "type": "mrkdwn", "text": "*Project:*\n`${{ inputs.name }}`" },
182+ { "type": "mrkdwn", "text": "*Release Type:*\n`${{ inputs.release-type }}`" },
183+ { "type": "mrkdwn", "text": "*Branch:*\n`${{ github.ref_name }}`" }
184+ ]
185+ },
186+ {
187+ "type": "section",
188+ "fields": [
189+ { "type": "mrkdwn", "text": "*Build:*\n`${{ steps.build.outcome == 'success' && '✅ Success' || '❌ Failed' }}`" },
190+ { "type": "mrkdwn", "text": "*Firebase Upload:*\n`${{ steps.firebase-upload.outcome == 'success' && '✅ Success' || steps.firebase-upload.outcome == 'failure' && '❌ Failed' || '⏭️ Skipped' }}`" },
191+ { "type": "mrkdwn", "text": "*S3 Upload:*\n`${{ steps.s3-upload.outcome == 'success' && '✅ Success' || steps.s3-upload.outcome == 'failure' && '❌ Failed' || '⏭️ Skipped' }}`" },
192+ { "type": "mrkdwn", "text": "*Overall Status:*\n`${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}`" }
193+ ]
194+ },
195+ {
196+ "type": "actions",
197+ "elements": [
198+ {
199+ "type": "button",
200+ "text": { "type": "plain_text", "text": "View Workflow Run" },
201+ "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
202+ }${{ steps.build.outcome == 'success' && steps.firebase-upload.outcome == 'success' && secrets.firebase-url != '' && format(',{{"type":"button","text":{{"type":"plain_text","text":"View in Firebase"}},"url":"{0}"}}', secrets.firebase-url) || '' }}
203+ ]
204+ }
205+ ]
206+ }
0 commit comments