github actions to deploy to google play #1
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
name: Deploy To Google Play | |
on: | |
push: | |
branches: [main] | |
jobs: | |
test: | |
name: Unit Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: 17 | |
cache: 'gradle' | |
- name: Setup Authorization with Firebase | |
run: echo '${{ secrets.FIREBASE_AUTH_JSON }}' > app/src/google-services.json | |
- name: Grant execute permissions for gradlew | |
run: chmod +x gradlew | |
- name: Run unit tests | |
run: ./gradlew clean testDebug | |
distribute: | |
name: Distribute bundle to Google Play | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: 17 | |
cache: 'gradle' | |
- name: Setup Authorization with Firebase | |
run: echo '${{ secrets.FIREBASE_AUTH_JSON }}' > app/src/google-services.json | |
- name: Version Bump | |
uses: chkfung/android-version-actions@v1.2.3 | |
with: | |
gradlePath: app/build.gradle.kts | |
versionCode: ${{ github.run_number }} | |
versionName: 1.3.2 | |
- name: Assemble Release Bundle | |
run: ./gradlew bundleRelease | |
- name: Sign Release | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/bundle/release | |
signingKeyBase64: ${{ secrets.ANDROID_KEYSTORE }} | |
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} | |
alias: ${{ secrets.ANDROID_DEVS_ALIAS }} | |
keyPassword: ${{ secrets.ANDROID_DEVS_ALIAS_PASSWORD }} | |
- name: Setup Authorization with Google Play Store | |
run: echo '${{ secrets.PLAY_AUTH_JSON }}' > service_account.json | |
- name: Deploy bundle to Google Play | |
uses: r0adkll/upload-google-play@v1.1.3 | |
with: | |
serviceAccountJson: service_account.json | |
packageName: nl.jovmit.androiddevs | |
releaseFiles: app/build/outputs/bundle/release/app-release.aab | |
track: 'production' | |
status: 'completed' |