0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-20 04:12:14 +02:00
UrlChecker/.github/workflows/alpha.yml
TrianguloY 36d187458e reduced actions permissions
from the repository settings (read-only permission by default and run only verified actions).
These changes are those required to avoid breaking existing workflows
2022-10-23 12:00:42 +02:00

64 lines
1.9 KiB
YAML

# 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:
# parameters
env:
VARIANT: alpha
TAG: alpha
ZIP: app-alpha.zip
permissions:
contents: write # need to update tag and release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get the repository files
uses: actions/checkout@v3
- name: Set Up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: Set gradlew as executable
# for some reason the gradle-build-action doesn't do this automatically
run: chmod +x ./gradlew
- name: Build & assemble with gradle
uses: gradle/gradle-build-action@v2
with:
arguments: >
build
assemble${{ env.VARIANT }}
- name: Zip ${{ env.VARIANT }} apk as ${{ env.ZIP }}
# just remove the password here if you want to build the apk yourself instead of sponsoring me and getting it as a benefit :(
run: zip -j -P ${{ secrets.ALPHA_PASS }} ${{ env.ZIP }} app/build/outputs/apk/${{ env.VARIANT }}/app-${{ env.VARIANT }}.apk
- 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 }}
- name: Upload ${{ env.ZIP }} to ${{ env.TAG }} release
# 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 }}