refactor: Migrate to Coil3 #232
This file contains hidden or 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: CI | |
on: | |
push: | |
branches: | |
- master | |
- dev/** | |
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/cancel-workflow-action@0.11.0 | |
with: | |
access_token: ${{ github.token }} | |
all_but_latest: true | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Gradle | |
uses: null2264/actions/gradle-setup@b697b0b95bb90ab23c1145b744dddd2fd3e3a838 | |
with: | |
java: 17 | |
distro: adopt | |
- name: Copy CI gradle.properties | |
run: | | |
mkdir -p ~/.gradle | |
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Extract branch name | |
id: branch_name | |
shell: bash | |
run: echo "NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
- name: Get changelog | |
id: changelog | |
shell: bash | |
run: | | |
{ | |
echo "CHANGELOG<<END_OF_FILE" | |
cat CHANGELOG.md || echo "" | |
echo | |
echo "END_OF_FILE" | |
} >> "$GITHUB_OUTPUT" 2> /dev/null | |
# 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: steps.branch_name.outputs.NAME == 'master' && 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 and run tests | |
if: startsWith(env.VERSION_TAG, 'v') | |
run: ./gradlew assembleStandardRelease testStandardReleaseUnitTest | |
# NIGHTLY | |
- name: Build nightly build and run tests | |
if: startsWith(env.VERSION_TAG, 'r') | |
run: ./gradlew assembleStandardNightly testStandardNightlyUnitTest | |
# DEBUG | |
- name: Build and run tests | |
if: startsWith(env.VERSION_TAG, 'r') != true && startsWith(env.VERSION_TAG, 'v') != true | |
run: ./gradlew assembleStandardDebug testStandardDebugUnitTest | |
- name: Publish test report | |
uses: mikepenz/action-junit-report@v4 | |
if: success() || failure() | |
with: | |
include_passed: true | |
detailed_summary: true | |
report_paths: '**/build/test-results/test*/TEST-*.xml' | |
- 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: | | |
${{ steps.changelog.outputs.CHANGELOG }} | |
--- | |
### 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 }} | | |
> [!TIP] | |
> | |
> If you are unsure which version to download then go with **yokai-${{ env.VERSION_TAG }}.apk** | |
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: 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. Please download the latest stable releases instead (https://github.com/null2264/yokai/releases/latest) | |
${{ steps.changelog.outputs.CHANGELOG }} | |
--- | |
### 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 }} | | |
> [!TIP] | |
> | |
> If you are unsure which version to download then go with **yokai-${{ env.VERSION_TAG }}.apk** | |
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 }} | |
- 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 }} |