Skip to content

refactor: Split preference and app di module #26

refactor: Split preference and app di module

refactor: Split preference and app di module #26

Workflow file for this run

name: CI
on:
push:
branches:
- master
workflow_dispatch:
inputs:
version:
description: 'Version (without "v" prefix)'
required: true
type: string
jobs:
build:
name: Build app
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
all_but_latest: true
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Copy CI gradle.properties
run: |
mkdir -p ~/.gradle
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
# PROD
- name: Prepare release build
if: github.event.inputs.version != ''
run: |
set -x
echo "VERSION_TAG=v${{github.event.inputs.version}}" >> $GITHUB_ENV
# NIGHTLY
- name: Prepare nightly build
if: github.event.inputs.version == ''
run: |
set -x
echo "VERSION_TAG=r$(git rev-list --count HEAD)" >> $GITHUB_ENV
echo "PREV_TAG=$(git tag -l | grep 'r' | tail -1)" >> $GITHUB_ENV
# PROD
- name: Build release build
if: startsWith(env.VERSION_TAG, 'v')
uses: gradle/gradle-command-action@v2
with:
arguments: assembleStandardRelease
# NIGHTLY
- name: Build nightly build
if: startsWith(env.VERSION_TAG, 'r')
uses: gradle/gradle-command-action@v2
with:
arguments: assembleStandardNightly
- name: Sign APK
if: env.VERSION_TAG != ''
uses: ilharp/sign-android-release@v1
id: sign_app
with:
releaseDir: app/build/outputs/apk/standard/${{ startsWith(env.VERSION_TAG, 'v') && 'release' || 'nightly' }}
signingKey: ${{ secrets.SIGNING_KEY }}
keyAlias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Clean up build artifacts
if: env.VERSION_TAG != ''
run: |
set -e
dir=app/build/outputs/apk/standard/${{ startsWith(env.VERSION_TAG, 'v') && 'release' || 'nightly' }}
mv $dir/app-standard-universal-*-signed.apk yokai-${{ env.VERSION_TAG }}.apk
sha=`sha256sum yokai-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV
cp $dir/app-standard-arm64-v8a-*-signed.apk yokai-arm64-v8a-${{ env.VERSION_TAG }}.apk
sha=`sha256sum yokai-arm64-v8a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV
cp $dir/app-standard-armeabi-v7a-*-signed.apk yokai-armeabi-v7a-${{ env.VERSION_TAG }}.apk
sha=`sha256sum yokai-armeabi-v7a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV
cp $dir/app-standard-x86-*-signed.apk yokai-x86-${{ env.VERSION_TAG }}.apk
sha=`sha256sum yokai-x86-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
echo "APK_X86_SHA=$sha" >> $GITHUB_ENV
cp $dir/app-standard-x86_64-*-signed.apk yokai-x86_64-${{ env.VERSION_TAG }}.apk
sha=`sha256sum yokai-x86_64-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV
- name: Create Release
if: startsWith(env.VERSION_TAG, 'v')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION_TAG }}
name: Yōkai ${{ env.VERSION_TAG }}
body: |
---
### Checksums
| Variant | SHA-256 |
| ------- | ------- |
| Universal | ${{ env.APK_UNIVERSAL_SHA }}
| arm64-v8a | ${{ env.APK_ARM64_V8A_SHA }}
| armeabi-v7a | ${{ env.APK_ARMEABI_V7A_SHA }}
| x86 | ${{ env.APK_X86_SHA }} |
| x86_64 | ${{ env.APK_X86_64_SHA }} |
files: |
yokai-${{ env.VERSION_TAG }}.apk
yokai-arm64-v8a-${{ env.VERSION_TAG }}.apk
yokai-armeabi-v7a-${{ env.VERSION_TAG }}.apk
yokai-x86-${{ env.VERSION_TAG }}.apk
yokai-x86_64-${{ env.VERSION_TAG }}.apk
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete Old Nightly
if: startsWith(env.VERSION_TAG, 'r') && env.PREV_TAG != ''
run: gh release delete ${{ env.PREV_TAG }} --cleanup-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Nightly
if: startsWith(env.VERSION_TAG, 'r')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION_TAG }}
name: Yōkai Nightly (${{ env.VERSION_TAG }})
body: |
> [!CAUTION]
> _**This alpha version is for testing only!**_
> It is not ready for daily use and we do not guarantee its usability.
---
### Checksums
| Variant | SHA-256 |
| ------- | ------- |
| Universal | ${{ env.APK_UNIVERSAL_SHA }}
| arm64-v8a | ${{ env.APK_ARM64_V8A_SHA }}
| armeabi-v7a | ${{ env.APK_ARMEABI_V7A_SHA }}
| x86 | ${{ env.APK_X86_SHA }} |
| x86_64 | ${{ env.APK_X86_64_SHA }} |
files: |
yokai-${{ env.VERSION_TAG }}.apk
yokai-arm64-v8a-${{ env.VERSION_TAG }}.apk
yokai-armeabi-v7a-${{ env.VERSION_TAG }}.apk
yokai-x86-${{ env.VERSION_TAG }}.apk
yokai-x86_64-${{ env.VERSION_TAG }}.apk
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}