1
0

83 lines
2.4 KiB
YAML
Raw Normal View History

2024-05-20 21:56:09 +08:00
name: Android CI
on: [push, pull_request, workflow_dispatch]
2024-05-20 21:56:09 +08:00
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
2024-05-20 21:56:09 +08:00
with:
submodules: recursive
2024-06-18 17:34:05 +07:00
- name: Setup Android Development Environment
2024-05-20 21:56:09 +08:00
uses: android-actions/setup-android@v2
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Cache CMake
uses: actions/cache@v3
with:
path: |
/usr/local/lib/android/sdk/cmake/3.22.1
key: cmake-${{ runner.os }}-3.22.1
restore-keys: |
cmake-${{ runner.os }}-
2024-06-18 04:01:45 +07:00
- name: Install Dependencies
2024-05-20 21:56:09 +08:00
run: |
sdkmanager --install "cmake;3.22.1"
echo "cmake.dir=/usr/local/lib/android/sdk/cmake/3.22.1" > local.properties
2024-05-20 22:02:54 +08:00
- name: Setup Java JDK
uses: actions/setup-java@v4.2.1
with:
distribution: 'temurin'
java-version: '21'
2024-06-18 17:34:05 +07:00
- 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
2024-05-20 22:02:54 +08:00
2024-06-18 17:34:05 +07:00
- name: Grant Execute Permission for Gradlew
2024-05-20 21:56:09 +08:00
run: chmod +x gradlew
2024-05-20 21:56:09 +08:00
- name: Build with Gradle
run: ./gradlew build
- uses: ilharp/sign-android-release@v1
2024-06-18 04:01:45 +07:00
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
2024-06-18 17:34:05 +07:00
- name: Rename Signed APK
2024-06-18 17:15:21 +07:00
run: |
2024-06-18 17:23:50 +07:00
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
2024-06-18 17:15:21 +07:00
2024-05-23 09:36:51 +08:00
- uses: actions/upload-artifact@v4
2024-05-20 21:56:09 +08:00
with:
2024-06-18 17:15:21 +07:00
name: Gakumas-Localify-EN
path: ${{ env.SIGNED_APK }}