Skip to content

Gradle Tasks

Gradle Tasks #7

Workflow file for this run

name: "Gradle Tasks"
on:
push:
branches:
- master
tags:
- "v*.*.*"
pull_request:
branches:
- master
schedule:
# ensures that workflow runs AT LEAST every 60 days to keep artifacts downloadable
- cron: "0 3 15 */2 *"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
# - setup java
# - setup gradle cache
# - setup android sdk
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'
# we don't need to declare any additional cache paths, the cache already catches everything
- uses: android-actions/setup-android@v3
- run: "chmod +x ./gradlew" # this project is used from windows, so it can be messed up
- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: "Build Debug APK"
run: "./gradlew build --no-daemon"
- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: "Upload Debug APK"
uses: actions/upload-artifact@v4
with:
path: |
app/build/outputs/apk/debug/app-debug.apk
- if: startsWith(github.ref, 'refs/tags/')
name: Decode Keystore
env:
ENCODED_STRING: ${{ secrets.KEYSTORE_FILE }}
run: |
echo $ENCODED_STRING | base64 -di > /tmp/keystore.jks
- if: startsWith(github.ref, 'refs/tags/')
name: Build Release APK
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
./gradlew assembleRelease --no-daemon \
-Pandroid.injected.signing.store.file=/tmp/keystore.jks \
-Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD \
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
-Pandroid.injected.signing.key.password=$KEY_PASSWORD
- if: startsWith(github.ref, 'refs/tags/')
name: Upload Release APK
uses: softprops/action-gh-release@v2
with:
files: app/build/outputs/apk/release/app-release.apk