Skip to content

Commit

Permalink
feat: set up Android prod deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
boringcactus committed Dec 17, 2024
1 parent f8aaf69 commit 00e73f8
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 6 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/android-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Android Prod Deploy

on:
push:
tags:
- android-*
workflow_dispatch:

concurrency:
group: android-prod

jobs:
build-android:
name: Build for Android
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
java: true
kotlin-cache: true
rsvg: true
ruby: true
gcp-provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
gcp-service-account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Fetch AWS secrets
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
mobile-app-android-upload-key-passphrase
- name: Load code signing key
run: |
cd androidApp
aws secretsmanager get-secret-value --secret-id mobile-app-android-upload-key --output json | jq -r '.SecretBinary' | base64 --decode > upload-keystore.jks
- name: Build Android app
env:
KEYSTORE_FILE: "${{ github.workspace }}/androidApp/upload-keystore.jks"
KEYSTORE_PASSWORD: ${{ env.MOBILE_APP_ANDROID_UPLOAD_KEY_PASSPHRASE }}
KEY_ALIAS: "upload"
KEY_PASSWORD: ${{ env.MOBILE_APP_ANDROID_UPLOAD_KEY_PASSPHRASE }}
MAPBOX_SECRET_TOKEN: ${{ secrets.MAPBOX_SECRET_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
bundle exec fastlane android build flavor:Prod
- uses: actions/upload-artifact@v4
with:
name: android-apk
path: androidApp/build/outputs/apk/prod/release/androidApp-prod-release.apk
- uses: actions/upload-artifact@v4
with:
name: android-aab
path: androidApp/build/outputs/bundle/prodRelease/androidApp-prod-release.aab
deploy-android:
name: Upload to Google Play
concurrency:
group: deploy-android
cancel-in-progress: false
needs:
- build-android
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: android-aab
path: androidApp/build/outputs/bundle/prodRelease
- uses: ./.github/actions/setup
with:
gcp-provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
gcp-service-account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
ruby: true
- name: Upload to Google Play
run: |
bundle exec fastlane android internal flavor:Prod
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ aws secretsmanager get-secret-value --secret-id mobile-app-android-upload-key-pa

### Production Deploys

Pushing a new tag will automatically deploy to the internal testing group (on iOS), and then release notes can be added and the build can be more widely published manually.
Pushing a new tag with the `ios-` prefix will automatically deploy to the iOS internal testing group, and then release notes can be added and the build can be more widely published manually.

The tag should match the version exactly - no `v` prefix - and the version needs to be set beforehand in `iosApp/iosApp/Info.plist`.
Pushing a new tag with the `android-` prefix will automatically deploy to the Android internal testing group, and then release notes can be added and the build can be promoted to testing/prod manually.

Android production deploys aren't set up yet.
The tag should be `<platform>-X.Y.Z` - no `v` prefix - and the version needs to be set beforehand in `iosApp/iosApp/Info.plist` and/or `androidApp/build.gradle.kts`.
2 changes: 1 addition & 1 deletion androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
targetSdk = 34
versionCode =
Integer.parseInt((findProperty("android.injected.version.code") ?: "1") as String)
versionName = (findProperty("android.injected.version.name") ?: "0.1.0") as String
versionName = "0.2.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
Expand Down
2 changes: 0 additions & 2 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ platform :android do
"android.injected.signing.key.alias" => ENV["KEY_ALIAS"],
"android.injected.signing.key.password" => ENV["KEY_PASSWORD"],
"android.injected.version.code" => next_version_code,
# TODO: Define the version name once and share it between iOS and Android
"android.injected.version.name" => "0.1.0",
}
gradle(
task: 'assemble',
Expand Down

0 comments on commit 00e73f8

Please sign in to comment.