2022-08-22 18:58:07 +02:00
|
|
|
# This action builds the alpha version as apk on a password protected zip,
|
|
|
|
# and uploads it to the alpha release.
|
|
|
|
# Adapted from https://github.com/amirisback/automated-build-android-app-with-github-action
|
|
|
|
name: Build alpha apk
|
|
|
|
|
|
|
|
on:
|
|
|
|
# Triggers the workflow on push events for the master branch
|
|
|
|
# push:
|
|
|
|
# branches:
|
|
|
|
# - master
|
|
|
|
|
|
|
|
# Run this workflow manually from the Actions tab
|
|
|
|
workflow_dispatch:
|
|
|
|
|
2022-09-04 10:43:28 +02:00
|
|
|
# parameters
|
|
|
|
env:
|
|
|
|
VARIANT: alpha
|
|
|
|
TAG: alpha
|
|
|
|
ZIP: app-alpha.zip
|
2022-08-22 18:58:07 +02:00
|
|
|
|
2022-10-23 11:55:01 +02:00
|
|
|
permissions:
|
|
|
|
contents: write # need to update tag and release
|
|
|
|
|
2022-08-22 18:58:07 +02:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Get the repository files
|
2023-10-06 16:59:07 +02:00
|
|
|
uses: actions/checkout@v4
|
2022-08-22 18:58:07 +02:00
|
|
|
|
2023-08-15 13:14:00 +02:00
|
|
|
- name: Set up JDK 17
|
2022-08-22 18:58:07 +02:00
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
2023-08-15 13:14:00 +02:00
|
|
|
java-version: '17'
|
2022-08-22 18:58:07 +02:00
|
|
|
distribution: 'temurin'
|
|
|
|
|
2022-08-28 17:03:35 +02:00
|
|
|
- name: Set gradlew as executable
|
|
|
|
# for some reason the gradle-build-action doesn't do this automatically
|
2022-08-22 18:58:07 +02:00
|
|
|
run: chmod +x ./gradlew
|
|
|
|
|
2022-08-28 17:03:35 +02:00
|
|
|
- name: Build & assemble with gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
|
|
|
with:
|
|
|
|
arguments: >
|
|
|
|
build
|
2022-09-04 10:43:28 +02:00
|
|
|
assemble${{ env.VARIANT }}
|
2022-08-22 18:58:07 +02:00
|
|
|
|
2022-09-04 10:43:28 +02:00
|
|
|
- name: Zip ${{ env.VARIANT }} apk as ${{ env.ZIP }}
|
2022-10-23 11:55:01 +02:00
|
|
|
# just remove the password here if you want to build the apk yourself instead of sponsoring me and getting it as a benefit :(
|
2022-09-04 10:43:28 +02:00
|
|
|
run: zip -j -P ${{ secrets.ALPHA_PASS }} ${{ env.ZIP }} app/build/outputs/apk/${{ env.VARIANT }}/app-${{ env.VARIANT }}.apk
|
2022-08-22 18:58:07 +02:00
|
|
|
|
2022-09-04 10:43:28 +02:00
|
|
|
- name: Update ${{ env.TAG }} tag to current commit
|
|
|
|
# equivalent to EndBug/latest-tag@latest but simpler
|
|
|
|
run: |
|
|
|
|
git tag --force ${{ env.TAG }}
|
|
|
|
git push --force origin tag ${{ env.TAG }}
|
2022-08-22 18:58:07 +02:00
|
|
|
|
2022-09-04 10:43:28 +02:00
|
|
|
- name: Upload ${{ env.ZIP }} to ${{ env.TAG }} release
|
2022-10-05 23:26:46 +02:00
|
|
|
# equivalent to softprops/action-gh-release@v1 but using official cli
|
|
|
|
run: |
|
|
|
|
gh release upload ${{ env.TAG }} ${{ env.ZIP }} --clobber
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|