Android - Release to Google Play #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create android release AAB and upload play store | |
# Required Secrets | |
# - ANDROID_KEY_ALIAS | |
# - ANDROID_KEY_PASSWORD | |
# - ANDROID_KEY_STORE_PASSWORD | |
# - ANDROID_SIGNING_KEY_B64 | |
# - GOOGLE_PLAY_SERVICE_ACCOUNT_JSON | |
# - GOOGLE_SERVICES_JSON | |
name: Android - Release to Google Play | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - main | |
jobs: | |
android_release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
############################################################################# | |
# Node Modules | |
# Manually restore any previous cache to speed install | |
# As immutable install will not change cache only save new cache if not hit | |
# Uses fine-grained methods from https://github.com/actions/cache | |
############################################################################# | |
- uses: actions/cache/restore@v3 | |
id: cache | |
with: | |
path: ./.yarn/cache | |
key: ${{ runner.os }}-node-modules-yarn-v1-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node-modules-yarn-v1- | |
- name: Install node modules | |
run: yarn install --immutable | |
- uses: actions/cache/save@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
path: ./.yarn/cache | |
key: ${{ runner.os }}-node-modules-yarn-v1-${{ hashFiles('yarn.lock') }} | |
- name: Populate google-services.json | |
env: | |
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: echo $GOOGLE_SERVICES_JSON > apps/picsa-apps/extension-app-native/android/app/google-services.json | |
- name: Build Extension App | |
run: yarn nx run picsa-apps-extension-app-native:build | |
# Re-sync as remote cache won't populate files during nx build command | |
- name: Sync Capacitor | |
run: npx cap sync | |
working-directory: apps/picsa-apps/extension-app-native | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
# - name: Build Android Debug APK | |
# working-directory: apps/picsa-apps/extension-app-native/android | |
# run: ./gradlew :app:assembleDebug | |
- name: Build Android Release Bundle | |
working-directory: apps/picsa-apps/extension-app-native/android | |
run: ./gradlew :app:bundleRelease | |
- name: Sign Android Release | |
id: sign_aab | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: apps/picsa-apps/extension-app-native/android/app/build/outputs/bundle/release | |
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY_B64 }} | |
alias: ${{ secrets.ANDROID_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
- name: Upload to Google play | |
uses: r0adkll/[email protected] | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }} | |
packageName: io.picsa.extension | |
releaseFiles: ${{steps.sign_aab.outputs.signedReleaseFile}} | |
track: internal | |
env: | |
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }} |