62 lines
2.5 KiB
YAML
62 lines
2.5 KiB
YAML
name: Build Release APK (Temporary)
|
|
|
|
on:
|
|
workflow_dispatch: # Allow manual triggering
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Release APK
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Java and Android SDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '21' # Adjust the Java version as needed
|
|
distribution: 'temurin'
|
|
|
|
- name: Decode Keystore
|
|
id: decode_keystore
|
|
uses: timheuer/base64-to-file@v1
|
|
with:
|
|
fileName: 'keystore/key.jks'
|
|
encodedString: ${{ secrets.SIGN_KEY }}
|
|
|
|
- name: Accept Android SDK licenses
|
|
run: yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
|
|
|
|
- name: Build Github Release APK
|
|
run: |
|
|
chmod +x ./gradlew
|
|
./gradlew clean assembleGithubRelease --no-build-cache --rerun-tasks
|
|
env:
|
|
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
|
|
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
|
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
|
|
|
- name: Extract Version Name and Version Code
|
|
run: |
|
|
# Extract versionName and versionCode from build.gradle
|
|
VERSION_NAME=$(cat app/build.gradle | grep -oP 'versionName "\K[^"]*')
|
|
VERSION_CODE=$(cat app/build.gradle | grep -oP 'versionCode \K\d+')
|
|
|
|
# Make the version name sentence case
|
|
VERSION_NAME=$(echo "$VERSION_NAME" | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2));}1')
|
|
|
|
echo "Version Name: $VERSION_NAME"
|
|
echo "Version Code: $VERSION_CODE"
|
|
|
|
# Set these values as environment variables for later steps
|
|
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
|
|
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
|
|
|
|
- name: Archive APKs
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.VERSION_NAME }}
|
|
path: |
|
|
app/build/outputs/apk/github/release/app-github-release.apk
|