Created
November 27, 2023 17:05
-
-
Save davirds/3d6d00c132f69e3c3a74873f24f0198c to your computer and use it in GitHub Desktop.
A pipeline for Android that builds and deploys the app using firebase app distribution
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: Pipeline | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'development' | |
- 'feature/*' | |
- 'fix/*' | |
pull_request: | |
branches: | |
- 'main' | |
- 'development' | |
jobs: | |
assemble: | |
name: Assemble Debug | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17.0.6' | |
distribution: 'zulu' | |
- name: Generate cache key | |
run: ./scripts/checksum.sh . checksum.txt | |
- name: Gradle cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches/modules-* | |
~/.gradle/caches/jars-* | |
~/.gradle/caches/build-cache-* | |
.gradle/* | |
key: gradle-${{ hashFiles('checksum.txt') }} | |
- name: Spotless check | |
run: ./gradlew spotlessCheck --stacktrace | |
- name: Assemble Debug | |
run: ./gradlew assembleDebug | |
- name: Cache APK | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
app/build/* | |
key: apk | |
deploy: | |
name: Firebase Deploy | |
needs: assemble | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Generate Notes | |
run: | | |
echo "#$PR_NUMBER \n$(git show -s --format=%s)" > distribution/notes.txt | |
- name: Setup Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17.0.6' | |
distribution: 'zulu' | |
- name: Generate cache key | |
run: ./scripts/checksum.sh . checksum.txt | |
- name: Recover Gradle cache | |
uses: actions/cache/restore@v3 | |
with: | |
key: gradle-${{ hashFiles('checksum.txt') }} | |
- name: Recover APKs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
app/build/* | |
key: apk | |
- name: Generate credentials | |
run: echo ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | base64 --decode > distribution/credentials.json | |
- name: Upload Debug App | |
run: ./gradlew appDistributionUploadDebug --stacktrace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment