Skip to content

APK Builder

APK Builder #3

Workflow file for this run

name: APK build
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build Release APK
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Load the google-services.json file from the secrets
- name: Load Google Service file
env:
DATA: ${{ secrets.GOOGLE_SERVICES }}
run: echo $DATA | base64 -di > app/google-services.json
# Load the keystore file from the secrets
- name: Load Keystore file
env:
DATA: ${{ secrets.KEYSTORE_JKS}}
run: echo $DATA | base64 -di > app/upload-keystore.jks
# Load the keystore.properties file from the secrets
- name: Load Keystore properties file
env:
DATA: ${{ secrets.KEYSTORE}}
run: echo $DATA | base64 -di > keystore.properties
# Load the secrets
- name: Load secrets
env:
DATA: ${{ secrets.SECRETS }}
run: |
echo $DATA | base64 -di > secrets.properties
echo $DATA | base64 -di > local.defaults.properties
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build APK
run: ./gradlew assembleRelease
- name: Create APK output directory
run: mkdir -p app/build/outputs/apk/release/
- name: Generate release tag
id: tag
run: |
echo "release_tag=streetworkapp_$(date +"%Y.%m.%d_%H-%M")" >> $GITHUB_OUTPUT
- name: Rename APK
run: mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/${{ steps.tag.outputs.release_tag }}.apk
- name: Upload APK in artifacts
uses: actions/upload-artifact@v4
with:
name: streetworkapp
path: app/build/outputs/apk/release/${{ steps.tag.outputs.release_tag }}.apk
if-no-files-found: error
retention-days: 90
- name: Load and Decode Google Maps API Key
env:
DATA: ${{ secrets.LOCAL_PROPERTIES }}
run: |
echo $DATA | base64 -di | grep "MAPS_API_KEY" >> local.defaults.properties
- name: Release APK
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: app/build/outputs/apk/release/${{ steps.tag.outputs.release_tag }}.apk
draft: false
token: ${{ secrets.GITHUB_TOKEN }}