Skip to content

Commit

Permalink
chore(app): add release app signing in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mikonse committed Nov 12, 2023
1 parent 00786db commit a39cc24
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
45 changes: 41 additions & 4 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,20 @@ jobs:
working-directory: frontend
steps:
- uses: actions/checkout@v3

- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: npm ci

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- uses: actions/cache@v3
with:
path: |
Expand All @@ -100,12 +104,45 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build web app
run: npx nx build-android mobile

- name: Build App Bundle
run: npx nx build-android mobile --mode release

- name: Build App APK
run: npx nx build-android mobile --tasks assembleRelease

- name: Sign App Bundle
id: sign_app
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: frontend/apps/mobile/android/app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_KEY_STORE_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}

- name: Sign App APK
id: sign_app_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: frontend/apps/mobile/android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_KEY_STORE_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}

- name: Upload AAB
uses: actions/upload-artifact@v3
with:
name: app-release-aab
path: frontend/apps/mobile/android/app/build/outputs/bundle/release/app-release.aab

- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app-debug-apk
path: apps/mobile/android/app/build/outputs/apk/debug/app-debug.apk
name: app-release-apk
path: frontend/apps/mobile/android/app/build/outputs/apk/release/app-release.apk

12 changes: 11 additions & 1 deletion frontend/apps/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ android {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (project.hasProperty('ABRECHNUNG_UPLOAD_STORE_FILE')) {
storeFile file(ABRECHNUNG_UPLOAD_STORE_FILE)
storePassword ABRECHNUNG_UPLOAD_STORE_PASSWORD
keyAlias ABRECHNUNG_UPLOAD_KEY_ALIAS
keyPassword ABRECHNUNG_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
debug {
Expand All @@ -101,7 +109,9 @@ android {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
if (project.hasProperty('ABRECHNUNG_UPLOAD_STORE_FILE')) {
signingConfig signingConfigs.release
}
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

Expand Down

0 comments on commit a39cc24

Please sign in to comment.