Skip to content

Commit

Permalink
chore: [sc-12915] Add GitHub Actions to build sandbox, staging and pr…
Browse files Browse the repository at this point in the history
…oduction bundles required for Tramline (#5143)

Story details: https://app.shortcut.com/simpledotorg/story/12915
  • Loading branch information
msasikanth authored Nov 27, 2024
1 parent 9479980 commit e0ad1c1
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 2 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/build_prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build production app bundle

on:
workflow_dispatch:
inputs:
tramline-input:
description: "Tramline input"
required: false

jobs:
build:
runs-on: [ ubuntu-latest ]
env:
TERM: dumb
ORG_GRADLE_PROJECT_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
ORG_GRADLE_PROJECT_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
ORG_GRADLE_PROJECT_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
steps:
- name: Configure Tramline
id: tramline
uses: tramlinehq/[email protected]
with:
input: ${{ github.event.inputs.tramline-input }}

- name: Setup version code and name
id: version_code_and_name
run: |
VERSION_NAME=${{ steps.tramline.outputs.version_name:-"1.0.0" }}
VERSION_CODE=${{ steps.tramline.outputs.version_code:-"1" }}
echo "ORG_GRADLE_PROJECT_VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
cache: 'gradle'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Decrypt secrets
run: gpg --batch --yes --quiet --decrypt --passphrase=${{ secrets.KEYSTORE_PASSPHRASE }} --output release/simple.store release/simple.gpg

- name: Build release bundle
run: |
./gradlew
-PrunProguard=true
-PsentryUploadProguard=true
-PmanifestEndpoint=MANIFEST_ENDPOINT_PRODUCTION
-PandroidNdkVersion=$NDK_VERSION
-PsentryDsn=${{ secrets.SENTRY_DSN }}
-PsentryEnvironment=production
-PdisableScreenshot=true
-PallowRootedDevice=false
-PdatadogApplicationId=${{ secrets.DATADOG_APPLICATION_ID }}
-PdatadogClientToken=${{ secrets.DATADOG_CLIENT_TOKEN }}
-PdatadogEnvironment=production
-PsentryOrg=$SENTRY_ORG
-PsentryProject=$SENTRY_PROJECT
-PsentryAuthToken=${{ secrets.SENTRY_AUTH_TOKEN }}
bundleProductionRelease
- name: Upload release bundle
uses: actions/upload-artifact@v4
with:
name: release.aab
path: app/build/outputs/bundle/productionRelease/app-production-release.aab

- name: Clean secrets
run: |
rm -f release/simple.store
74 changes: 74 additions & 0 deletions .github/workflows/build_sandbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build staging app bundle

on:
workflow_dispatch:
inputs:
tramline-input:
description: "Tramline input"
required: false

jobs:
build:
runs-on: [ ubuntu-latest ]
env:
TERM: dumb
ORG_GRADLE_PROJECT_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
ORG_GRADLE_PROJECT_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
ORG_GRADLE_PROJECT_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
steps:
- name: Configure Tramline
id: tramline
uses: tramlinehq/[email protected]
with:
input: ${{ github.event.inputs.tramline-input }}

- name: Setup version code and name
id: version_code_and_name
run: |
VERSION_NAME=${{ steps.tramline.outputs.version_name:-"1.0.0" }}
VERSION_CODE=${{ steps.tramline.outputs.version_code:-"1" }}
echo "ORG_GRADLE_PROJECT_VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
cache: 'gradle'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Decrypt secrets
run: gpg --batch --yes --quiet --decrypt --passphrase=${{ secrets.KEYSTORE_PASSPHRASE }} --output release/simple.store release/simple.gpg

- name: Build release bundle
run: |
./gradlew
-PrunProguard=true
-PmanifestEndpoint=$MANIFEST_ENDPOINT_SANDBOX
-PandroidNdkVersion=$NDK_VERSION
-PsentryDsn=${{ secrets.SENTRY_DSN }}
-PsentryEnvironment=sandbox
-PdatadogApplicationId=${{ secrets.DATADOG_APPLICATION_ID }}
-PdatadogClientToken=${{ secrets.DATADOG_CLIENT_TOKEN }}
-PdatadogEnvironment=sandbox
-PsentryOrg=$SENTRY_ORG
-PsentryProject=$SENTRY_PROJECT
-PsentryAuthToken=${{ secrets.SENTRY_AUTH_TOKEN }}
bundleSandboxRelease
- name: Upload release bundle
uses: actions/upload-artifact@v4
with:
name: release.aab
path: app/build/outputs/bundle/sandboxRelease/app-sandbox-release.aab

- name: Clean secrets
run: |
rm -f release/simple.store
74 changes: 74 additions & 0 deletions .github/workflows/build_staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build staging app bundle

on:
workflow_dispatch:
inputs:
tramline-input:
description: "Tramline input"
required: false

jobs:
build:
runs-on: [ ubuntu-latest ]
env:
TERM: dumb
ORG_GRADLE_PROJECT_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
ORG_GRADLE_PROJECT_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
ORG_GRADLE_PROJECT_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
steps:
- name: Configure Tramline
id: tramline
uses: tramlinehq/[email protected]
with:
input: ${{ github.event.inputs.tramline-input }}

- name: Setup version code and name
id: version_code_and_name
run: |
VERSION_NAME=${{ steps.tramline.outputs.version_name:-"1.0.0" }}
VERSION_CODE=${{ steps.tramline.outputs.version_code:-"1" }}
echo "ORG_GRADLE_PROJECT_VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
cache: 'gradle'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Decrypt secrets
run: gpg --batch --yes --quiet --decrypt --passphrase=${{ secrets.KEYSTORE_PASSPHRASE }} --output release/simple.store release/simple.gpg

- name: Build release bundle
run: |
./gradlew
-PrunProguard=true
-PmanifestEndpoint=$MANIFEST_ENDPOINT_STAGING
-PandroidNdkVersion=$NDK_VERSION
-PsentryDsn=${{ secrets.SENTRY_DSN }}
-PsentryEnvironment=staging
-PdatadogApplicationId=${{ secrets.DATADOG_APPLICATION_ID }}
-PdatadogClientToken=${{ secrets.DATADOG_CLIENT_TOKEN }}
-PdatadogEnvironment=staging
-PsentryOrg=$SENTRY_ORG
-PsentryProject=$SENTRY_PROJECT
-PsentryAuthToken=${{ secrets.SENTRY_AUTH_TOKEN }}
bundleStagingRelease
- name: Upload release bundle
uses: actions/upload-artifact@v4
with:
name: release.aab
path: app/build/outputs/bundle/stagingRelease/app-staging-release.aab

- name: Clean secrets
run: |
rm -f release/simple.store
12 changes: 12 additions & 0 deletions .github/workflows/ci_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ jobs:

verify_release_bundles:
runs-on: [ ubuntu-latest ]
env:
TERM: dumb
ORG_GRADLE_PROJECT_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
ORG_GRADLE_PROJECT_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
ORG_GRADLE_PROJECT_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
strategy:
matrix:
buildType: [ 'Production' ]
Expand All @@ -306,6 +311,9 @@ jobs:
java-version: 17
cache: 'gradle'

- name: Decrypt secrets
run: gpg --batch --yes --quiet --decrypt --passphrase=${{ secrets.KEYSTORE_PASSPHRASE }} --output release/simple.store release/simple.gpg

- name: Build ${{ matrix.buildType }} Release bundle
run: |
./gradlew \
Expand All @@ -314,6 +322,10 @@ jobs:
-PsentryUploadProguard=false \
bundle${{ matrix.buildType }}Release
- name: Clean secrets
run: |
rm -f release/simple.store
verify_room_schemas:
runs-on: [ ubuntu-latest ]
steps:
Expand Down
15 changes: 13 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ android {
}
}

signingConfigs {
create("release") {
storeFile = file("$rootDir/release/simple.store")
storePassword = "${project.properties["KEYSTORE_PASSWORD"]}"
keyAlias = "${project.properties["KEY_ALIAS"]}"
keyPassword = "${project.properties["KEY_PASSWORD"]}"
}
}

buildTypes {
getByName("debug") {
applicationIdSuffix = ".debug"
Expand All @@ -120,8 +129,10 @@ android {
isDebuggable = false
isMinifyEnabled = runProguard.toBoolean()
isShrinkResources = runProguard.toBoolean()
if (maestroTests.toBoolean()) {
signingConfig = getByName("debug").signingConfig
signingConfig = if (maestroTests.toBoolean()) {
getByName("debug").signingConfig
} else {
signingConfigs.getByName("release")
}
}
}
Expand Down
Binary file added release/simple.gpg
Binary file not shown.

0 comments on commit e0ad1c1

Please sign in to comment.