1
0
Natsu 9ac060a1da
All checks were successful
Android CI / build (push) Successful in 4m33s
chore(build.yml): update sign-android-release action to use r0adkll/sign-android-release@v1
feat(build.yml): update upload-artifact action to use actions/upload-artifact@v3
feat(build.yml): remove send notification to Discord step
2024-07-06 14:11:10 +07:00

83 lines
2.4 KiB
YAML

name: Android CI
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Setup Android Development Environment
uses: android-actions/setup-android@v3
- name: Install Dependencies
run: |
sdkmanager --install "cmake;3.22.1"
echo "cmake.dir=$ANDROID_HOME/cmake/3.22.1" > local.properties
echo "$ANDROID_HOME/build-tools/34.0.0" >> $GITHUB_PATH
- name: Get Branch and Hash Info
run: |
branch=$(git rev-parse --abbrev-ref HEAD)
hash=$(git rev-parse --short=7 HEAD)
echo "VERSION=$branch.$hash" >> $GITHUB_ENV
- name: Pull Assets
run: |
git clone https://github.com/NatsumeLS/Gakumas-Translation-Data-EN.git app/src/main/assets/gakumas-local
- name: Grant Execute Permission for Gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.KEYSTOREB64 }}
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
continue-on-error: true
- name: Rename Signed APK
run: |
branch=$(git rev-parse --abbrev-ref HEAD)
hash=$(git rev-parse --short=7 HEAD)
mv ${{steps.sign_app.outputs.signedReleaseFile}} app/build/outputs/apk/release/Gakumas-Localify-EN_$branch.$hash.apk
echo "SIGNED_APK=app/build/outputs/apk/release/Gakumas-Localify-EN_$branch.$hash.apk" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Gakumas-Localify-EN
path: ${{ env.SIGNED_APK }}
- name: Send New Build Notification to Discord
uses: sarisia/actions-status-discord@v1
if: success()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: New Build
color: 0xffd1dc
description: |
Version: `${{ env.VERSION }}`
[Download](https://git.natsume.io/NatsumeLS/Gakumas-Localify-EN/actions)