Skip to content

Commit a56ab82

Browse files
chore: upload builds to bucket (#241)
1 parent ec01db3 commit a56ab82

14 files changed

+352
-38
lines changed

.github/workflows/release-android-base.yaml

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: release-android-base
22

33
permissions:
4+
id-token: write
45
contents: read
56

67
on:
@@ -18,6 +19,10 @@ on:
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
@@ -45,6 +50,13 @@ on:
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

4961
jobs:
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+
uses: slackapi/[email protected]
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+
}

.github/workflows/release-dapp-android-internal.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: release-android-appkit-internal
22

33
permissions:
4+
id-token: write
45
contents: read
56

67
on: workflow_dispatch
@@ -12,6 +13,7 @@ jobs:
1213
name: AppKit React Native
1314
root-path: 'dapps/W3MWagmi'
1415
release-type: 'internal'
16+
project-type: 'dapp'
1517
output-path: 'dapps/W3MWagmi/android/app/build/outputs/apk/internal/app-internal.apk'
1618
secrets:
1719
project-id: ${{ secrets.ENV_PROJECT_ID }}
@@ -23,3 +25,6 @@ jobs:
2325
gsa-key: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
2426
keystore-name: ${{ secrets.WC_INTERNAL_KEYSTORE_NAME }}
2527
keystore: ${{ secrets.WC_INTERNAL_KEYSTORE }}
28+
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
29+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
30+
firebase-url: ${{ secrets.FIREBASE_APPKIT_INTERNAL_URL }}

.github/workflows/release-dapp-android-production.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: release-android-appkit-production
22

33
permissions:
4+
id-token: write
45
contents: read
56

67
on: workflow_dispatch
@@ -12,6 +13,7 @@ jobs:
1213
name: AppKit React Native
1314
root-path: 'dapps/W3MWagmi'
1415
release-type: 'production'
16+
project-type: 'dapp'
1517
output-path: 'dapps/W3MWagmi/android/app/build/outputs/apk/release/app-release.apk'
1618
secrets:
1719
project-id: ${{ secrets.ENV_PROJECT_ID }}
@@ -23,3 +25,6 @@ jobs:
2325
gsa-key: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
2426
keystore-name: ${{ vars.WC_PROD_KEYSTORE_NAME }}
2527
keystore: ${{ secrets.WC_PROD_KEYSTORE }}
28+
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
29+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
30+
firebase-url: ${{ secrets.FIREBASE_APPKIT_PROD_URL }}

.github/workflows/release-dapp-ios-internal.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
name: release-ios-appkit-internal
22

33
permissions:
4+
id-token: write
45
contents: read
56

6-
on: workflow_dispatch
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
build-for-simulator:
11+
description: "Build for simulator instead of TestFlight"
12+
required: false
13+
default: false
14+
type: boolean
715

816
jobs:
917
release-internal:
@@ -17,6 +25,8 @@ jobs:
1725
scheme-name: 'W3MWagmi Internal'
1826
bundle-id: 'com.walletconnect.web3modal.rnsample.internal'
1927
apple-id: '6479817037'
28+
project-type: 'dapp'
29+
build-for-simulator: ${{ inputs.build-for-simulator }}
2030
secrets:
2131
project-id: ${{ secrets.ENV_PROJECT_ID }}
2232
relay-url: ${{ secrets.ENV_RELAY_URL }}
@@ -30,4 +40,7 @@ jobs:
3040
match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
3141
match-git-url: ${{ secrets.MATCH_GIT_URL }}
3242
match-ssh-key: ${{ secrets.MATCH_SSH_KEY }}
43+
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
44+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
45+
testflight-url: ${{ secrets.TESTFLIGHT_APPKIT_INTERNAL_URL }}
3346

.github/workflows/release-dapp-ios-production.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
name: release-ios-appkit-production
22

33
permissions:
4+
id-token: write
45
contents: read
56

6-
on: workflow_dispatch
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
build-for-simulator:
11+
description: "Build for simulator instead of TestFlight"
12+
required: false
13+
default: false
14+
type: boolean
715

816
jobs:
917
release-production:
@@ -17,6 +25,8 @@ jobs:
1725
scheme-name: 'W3MWagmi'
1826
bundle-id: 'com.walletconnect.web3modal.rnsample'
1927
apple-id: '6446700301'
28+
project-type: 'dapp'
29+
build-for-simulator: ${{ inputs.build-for-simulator }}
2030
secrets:
2131
project-id: ${{ secrets.ENV_PROJECT_ID }}
2232
relay-url: ${{ secrets.ENV_RELAY_URL }}
@@ -30,4 +40,7 @@ jobs:
3040
match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
3141
match-git-url: ${{ secrets.MATCH_GIT_URL }}
3242
match-ssh-key: ${{ secrets.MATCH_SSH_KEY }}
43+
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
44+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
45+
testflight-url: ${{ secrets.TESTFLIGHT_APPKIT_PROD_URL }}
3346

0 commit comments

Comments
 (0)