change #335
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI | |
on: | |
push: | |
branches: [ "beta" ] | |
paths-ignore: | |
- ".github/**" | |
- "!.github/workflows/**" | |
- ".idea/" | |
- "fastlane/" | |
- '.gitignore' | |
- "*.md" | |
- "LICENSE" | |
pull_request: | |
branches: [ "beta" ] | |
paths-ignore: | |
- ".github/**" | |
- "!.github/workflows/**" | |
- ".idea/" | |
- "fastlane/" | |
- '.gitignore' | |
- "*.md" | |
- "LICENSE" | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build App | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Set release type | |
run: echo releaseType=CI > package.properties | |
- name: Create signing files | |
if: github.event_name != 'pull_request' | |
run: | | |
mkdir -p ~/.gradle | |
echo "${{ secrets.KEYSTORE_SECRET }}" | base64 -d > ~/key.jks | |
echo "AKANE_RELEASE_STORE_FILE=$(realpath ~/key.jks)" > ~/.gradle/gradle.properties | |
echo "AKANE_RELEASE_STORE_PASSWORD=${{ secrets.KEYSTORE_PWD }}" >> ~/.gradle/gradle.properties | |
echo "AKANE_RELEASE_KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> ~/.gradle/gradle.properties | |
echo "AKANE_RELEASE_KEY_PASSWORD=${{ secrets.KEY_PWD }}" >> ~/.gradle/gradle.properties | |
- name: Build with Gradle | |
if: github.event_name != 'pull_request' | |
run: ./gradlew :app:assembleRelease | |
- name: Build with Gradle for pull request | |
if: github.event_name == 'pull_request' | |
run: ./gradlew :app:assembleDebug | |
- name: Find apk | |
if: github.event_name != 'pull_request' | |
run: | | |
APK_FILE=$(find app/build/outputs/apk/release -name '*.apk') | |
echo "APK_FILE=$APK_FILE" >> $GITHUB_ENV | |
echo "APK_FILE_NAME=$(basename $APK_FILE .apk)" >> $GITHUB_ENV | |
- name: Find apk for pull request | |
if: github.event_name == 'pull_request' | |
run: | | |
APK_FILE=$(find app/build/outputs/apk/debug -name '*.apk') | |
echo "APK_FILE=$APK_FILE" >> $GITHUB_ENV | |
echo "APK_FILE_NAME=$(basename $APK_FILE .apk)" >> $GITHUB_ENV | |
- name: Upload apk | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.APK_FILE_NAME }} | |
path: ${{ env.APK_FILE }} | |
compression-level: 9 |