Build & Distribute Release APK #70
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: Build & Distribute Release APK | |
on: | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decode Keystore | |
env: | |
ENCODED_STRING: ${{ secrets.STORE_FILE }} | |
run: | | |
TMP_KEYSTORE_FILE_PATH="${RUNNER_TEMP}"/keystore | |
mkdir "${TMP_KEYSTORE_FILE_PATH}" | |
echo $ENCODED_STRING | base64 -di > "${TMP_KEYSTORE_FILE_PATH}"/keystore.jks | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Cache Gradle wrapper | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/wrapper | |
key: gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle-wrapper- | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/caches/modules-2/files-2.1 | |
key: gradle-caches-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle-caches-${{ runner.os }}- | |
- name: Auth token to local.properties | |
env: | |
TMDB_AUTH_TOKEN: ${{ secrets.TMDB_AUTH_TOKEN }} | |
run: echo "TMDB_AUTH_TOKEN=${TMDB_AUTH_TOKEN}" >> local.properties | |
- name: Decode and create google-services.json | |
env: | |
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: echo $GOOGLE_SERVICES_JSON | base64 --decode > $GITHUB_WORKSPACE/app/google-services.json | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Build APK | |
run: ./gradlew app:assembleRelease | |
env: | |
SIGNING_KEY_ALIAS: ${{ secrets.STORE_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.STORE_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} | |
TMDB_AUTH_TOKEN: ${{ secrets.TMDB_AUTH_TOKEN }} | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Build Artifacts | |
path: app/build/outputs/ | |
- name: Build & Deploy Release | |
run: ./gradlew appDistributionUploadRelease -PbundlePath=app/build/outputs/apk/release/app-release.apk | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} |