Skip to content

Instantly share code, notes, and snippets.

@molidev8
Created July 29, 2022 08:39
Show Gist options
  • Save molidev8/4ab612a686bdc627c5e163e8f14deb15 to your computer and use it in GitHub Desktop.
Save molidev8/4ab612a686bdc627c5e163e8f14deb15 to your computer and use it in GitHub Desktop.
A YAML workflow to run unit test and sign an AAB for Android
name: Build, Test and Compile
on:
push:
branches: [ master ]
jobs:
Unit-Test:
runs-on: ubuntu-latest
# needs: Build
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: gradle
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Unit Test
run: ./gradlew testDebugUnitTest
Compile:
runs-on: ubuntu-latest
needs: Unit-Test
steps:
- uses: actions/checkout@v2
name: Checkout project
- uses: actions/setup-java@v2
name: Set up JDK
with:
java-version: '11'
distribution: 'adopt'
cache: gradle
- uses: actions/cache@v2
name: Caching Gradle
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Release Bundle
run: ./gradlew bundle
- uses: r0adkll/sign-android-release@v1
name: Sign Bundle
id: sign_app
with:
releaseDirectory: app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
- name: Upload Bundle
uses: actions/upload-artifact@v2
with:
name: release.aab
path: ${{steps.sign_app.outputs.signedReleaseFile}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment