Skip to content

APK Builder

APK Builder #6

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 with detailed logs
run: ./gradlew assembleRelease --stacktrace --info
- name: Find and list APK files
id: apkpath
run: |
find app/build/outputs/apk/ -name "*.apk" -exec ls -lh {} \;
echo "apk_path=$(find app/build/outputs/apk/ -name "*.apk")" >> $GITHUB_ENV
- name: Upload APK in artifacts
uses: actions/upload-artifact@v4
with:
name: streetworkapp-${{ inputs.tag_name }}
path: ${{ env.apk_path }}
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: ${{ inputs.tag_name }}
files: ${{ env.apk_path }}
draft: false
token: ${{ secrets.GITHUB_TOKEN }}