Skip to content

Android CI

Android CI #7

Workflow file for this run

name: Android CI
on:
push:
branches: [ "alpha" ]
paths-ignore:
- ".github/**"
- "!.github/workflows/**"
- ".idea/"
- "fastlane/"
- '.gitignore'
- "*.md"
- "LICENSE"
pull_request:
branches: [ "alpha" ]
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
- 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 == 'push' && !contains(github.event.head_commit.message, '[skip_signing_apk]')
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
run: ./gradlew :app:assembleRelease
- name: Find apk
run: |
echo "APK_FILE_X64=$(find app/build/outputs/apk/release -name '*-x86_64-*.apk')" >> $GITHUB_ENV
echo "APK_FILE_ARM64=$(find app/build/outputs/apk/release -name '*-arm64-v8a-*.apk')" >> $GITHUB_ENV
echo "APK_FILE_UNIVERSAL=$(find app/build/outputs/apk/release -name '*-universal-*.apk')" >> $GITHUB_ENV
GIT_COMMIT_HASH=$(git rev-parse --short HEAD)
ACCORD_VERSION=$(grep "versionName" app/build.gradle.kts | awk -F'"' '{print $2}' | head -n 1)
APK_FILE_NAME=Accord-$ACCORD_VERSION-$GIT_COMMIT_HASH
echo "APK_FILE_NAME_X64=$APK_FILE_NAME-x86_64" >> $GITHUB_ENV
echo "APK_FILE_NAME_ARM64=$APK_FILE_NAME-arm64-v8a" >> $GITHUB_ENV
echo "APK_FILE_NAME_UNIVERSAL=$APK_FILE_NAME-universal" >> $GITHUB_ENV
- name: Upload x86_64 apk
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_FILE_NAME_X64 }}
path: ${{ env.APK_FILE_X64 }}
compression-level: 9
- name: Upload arm64-v8a apk
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_FILE_NAME_ARM64 }}
path: ${{ env.APK_FILE_ARM64 }}
compression-level: 9
- name: Upload universal apk
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_FILE_NAME_UNIVERSAL }}
path: ${{ env.APK_FILE_UNIVERSAL }}
compression-level: 9