1
0

62 lines
1.8 KiB
YAML

name: Android CI
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: set up android development environment
uses: android-actions/setup-android@v2
- name: Install Dependencies
run: |
sdkmanager --install "cmake;3.22.1"
echo "cmake.dir=/usr/local/lib/android/sdk/cmake/3.22.1" > local.properties
- name: Setup Java JDK
uses: actions/setup-java@v4.2.1
with:
distribution: 'temurin'
java-version: '21'
- name: Write Branch and Hash info
run: |
branch=$(git rev-parse --abbrev-ref HEAD)
hash=$(git rev-parse --short=7 HEAD)
echo "$branch.$hash" > app/src/main/assets/gakumas-local/version.txt
- name: Grant execute permission for Gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- uses: ilharp/sign-android-release@v1
name: Sign App APK
id: sign_app
with:
releaseDir: app/build/outputs/apk/debug
signingKey: ${{ secrets.KEYSTOREB64 }}
keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
buildToolsVersion: 33.0.0
- name: Rename signed APK
run: |
branch=$(git rev-parse --abbrev-ref HEAD)
hash=$(git rev-parse --short=7 HEAD)
mv ${{steps.sign_app.outputs.signedFile}} app/build/outputs/apk/debug/Gakumas-Localify-EN_$branch.$hash.apk
echo "SIGNED_APK=app/build/outputs/apk/debug/Gakumas-Localify-EN_$branch.$hash.apk" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: Gakumas-Localify-EN
path: ${{ env.SIGNED_APK }}