Build and Release #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
workflow_dispatch: | |
inputs: | |
beta: | |
type: boolean | |
description: Is beta? | |
draft: | |
type: boolean | |
description: Is draft? | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Setup Android SDK | |
uses: android-actions/[email protected] | |
- name: Extract Version | |
id: extract_version | |
run: | | |
VERSION=$(grep -oP 'versionName = "\K[^"]+' app/build.gradle.kts) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
if [ ${{ inputs.beta }} == true ]; then BETA=true; else BETA=false; fi | |
echo "beta=$BETA" >> $GITHUB_OUTPUT | |
TAG="v$VERSION" | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
- name: Build Signed APK | |
run: | | |
echo "${{ secrets.keystore }}" | base64 -d > $GITHUB_WORKSPACE/signing-key.jks | |
chmod +x ./gradlew | |
./gradlew packageReleaseUniversalApk \ | |
-Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/signing-key.jks \ | |
-Pandroid.injected.signing.store.password=${{ secrets.keystore_password }} \ | |
-Pandroid.injected.signing.key.alias=${{ secrets.key_alias }} \ | |
-Pandroid.injected.signing.key.password=${{ secrets.key_password }} | |
- name: Rename APK | |
run: | | |
mv app/build/outputs/universal_apk/release/app-release-universal.apk ./Manager.apk | |
- name: Create Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create "${{ steps.extract_version.outputs.tag }}" \ | |
--title "${{ steps.extract_version.outputs.version }}" \ | |
--generate-notes \ | |
--prerelease ${{ steps.extract_version.outputs.beta }} \ | |
--draft ${{ github.event.inputs.draft }} \ | |
./Manager.apk |