ci: Nightly Build

This commit is contained in:
ziro 2024-01-11 07:56:19 +07:00
parent b5192304c8
commit a790c29a1d
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
5 changed files with 91 additions and 11 deletions

View file

@ -6,7 +6,7 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version'
description: 'Version (without "v" prefix)'
required: true
type: string
@ -41,17 +41,34 @@ jobs:
mkdir -p ~/.gradle
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
- name: Build app
# 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
# Sign APK and create release for tags
- name: Get tag name
if: github.event.inputs.version != ''
run: |
set -x
echo "VERSION_TAG=${{github.event.inputs.version}}" >> $GITHUB_ENV
# 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 != ''
@ -89,7 +106,7 @@ jobs:
echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV
- name: Create Release
if: env.VERSION_TAG != ''
if: startsWith(env.VERSION_TAG, 'v')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION_TAG }}
@ -116,3 +133,38 @@ jobs:
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 ${{ env.VERSION_TAG }}
body: |
### Disclaimer:
***This alpha version is for testing only.***
It is not ready for daily use and we do not guarantee its usability.
Please backup your data before using it!
---
### 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 }} |
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -77,6 +77,15 @@ android {
isMinifyEnabled = true
proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro")
}
create("nightly") {
initWith(getByName("release"))
buildConfigField("boolean", "BETA", "true")
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks.add("release")
versionNameSuffix = "-b${getCommitCount()}"
applicationIdSuffix = ".nightlyYokai"
}
}
buildFeatures {

View file

@ -93,7 +93,7 @@ class AboutController : SettingsController() {
preference {
key = "pref_version"
titleRes = R.string.version
summary = if (BuildConfig.DEBUG) {
summary = if (BuildConfig.DEBUG || BuildConfig.BETA) {
"r" + BuildConfig.COMMIT_COUNT
} else {
BuildConfig.VERSION_NAME

View file

@ -40,7 +40,7 @@ class DebugController : SettingsController() {
preference {
key = "pref_version"
title = "Version"
summary = if (BuildConfig.DEBUG) {
summary = if (BuildConfig.DEBUG || BuildConfig.BETA) {
"r" + BuildConfig.COMMIT_COUNT
} else {
BuildConfig.VERSION_NAME

View file

@ -24,6 +24,25 @@
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:636318130901:android:388d6d443528368657f85c",
"android_client_info": {
"package_name": "eu.kanade.tachiyomi.nightlyYokai"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBORypbgpIKGb8s3Si6gaQlY5CLkR804OI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:636318130901:android:0ae2cb126b21d3a357f85c",