2024-05-20 21:56:09 +08:00
|
|
|
name: Android CI
|
|
|
|
|
2024-06-14 23:02:31 +08:00
|
|
|
on: [push, pull_request, workflow_dispatch]
|
2024-05-20 21:56:09 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
2024-06-16 11:53:50 -05:00
|
|
|
|
2024-05-20 21:56:09 +08:00
|
|
|
- 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
|
2024-06-16 11:53:50 -05:00
|
|
|
npm install -g pnpm
|
2024-05-20 21:56:09 +08:00
|
|
|
|
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-10 10:58:39 -05:00
|
|
|
|
2024-06-16 11:53:50 -05:00
|
|
|
- name: Update Assets
|
|
|
|
run: |
|
2024-06-18 09:50:56 +08:00
|
|
|
git submodule foreach --recursive 'git pull --no-rebase origin main'
|
2024-06-16 11:53:50 -05:00
|
|
|
git clone https://${{ secrets.ACCESS_TOKEN_GITHUB }}@github.com/imas-tools/gakumas-raw-txts.git app/src/main/assets/gakumas-local/gakumas-raw-txts
|
|
|
|
mv app/src/main/assets/gakumas-local/gakumas-raw-txts/Resource app/src/main/assets/gakumas-local/raw
|
|
|
|
rm -rf app/src/main/assets/gakumas-local/gakumas-raw-txts
|
|
|
|
|
|
|
|
- name: Build Assets
|
|
|
|
run: |
|
|
|
|
mv app/src/main/assets/gakumas-local/GakumasPreTranslation/.env.sample app/src/main/assets/gakumas-local/GakumasPreTranslation/.env
|
|
|
|
cd app/src/main/assets/gakumas-local && make build-resource
|
|
|
|
|
2024-06-10 10:58:39 -05:00
|
|
|
- name: Write branch and commit info
|
|
|
|
run: |
|
|
|
|
branch=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
hash=$(git rev-parse --short=8 HEAD)
|
|
|
|
echo "$branch.$hash" > app/src/main/assets/gakumas-local/version.txt
|
2024-05-20 22:02:54 +08:00
|
|
|
|
2024-05-20 21:56:09 +08:00
|
|
|
- name: Grant execute permission for gradlew
|
|
|
|
run: chmod +x gradlew
|
2024-06-10 10:58:39 -05:00
|
|
|
|
2024-05-20 21:56:09 +08:00
|
|
|
- name: Build with Gradle
|
|
|
|
run: ./gradlew build
|
2024-06-10 10:58:39 -05:00
|
|
|
|
2024-06-14 23:02:31 +08:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: GakumasLocalify-Unsigned-apk
|
|
|
|
path: app/build/outputs/apk/debug/app-debug.apk
|
|
|
|
|
2024-06-10 10:58:39 -05:00
|
|
|
- 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
|
|
|
|
|
2024-05-23 09:36:51 +08:00
|
|
|
- uses: actions/upload-artifact@v4
|
2024-05-20 21:56:09 +08:00
|
|
|
with:
|
2024-06-14 23:02:31 +08:00
|
|
|
name: GakumasLocalify-Signed-apk
|
2024-06-10 10:58:39 -05:00
|
|
|
path: ${{steps.sign_app.outputs.signedFile}}
|