mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
ci: A way to draft beta release
This commit is contained in:
parent
114776bc53
commit
a83865e086
2 changed files with 57 additions and 9 deletions
47
.github/workflows/build_push.yml
vendored
47
.github/workflows/build_push.yml
vendored
|
@ -9,6 +9,11 @@ on:
|
|||
description: 'Version (without "v" prefix)'
|
||||
required: true
|
||||
type: string
|
||||
beta:
|
||||
description: 'Beta release'
|
||||
default: false
|
||||
required: false
|
||||
type: boolean
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
@ -58,11 +63,22 @@ jobs:
|
|||
|
||||
# PROD
|
||||
- name: Prepare release build
|
||||
if: github.event.inputs.version != ''
|
||||
if: github.event.inputs.version != '' && github.event.inputs.beta != 'true'
|
||||
run: |
|
||||
set -x
|
||||
echo "VERSION_TAG=v${{github.event.inputs.version}}" >> $GITHUB_ENV
|
||||
|
||||
# BETA
|
||||
- name: Prepare beta build
|
||||
if: github.event.inputs.version != '' && github.event.inputs.beta == 'true'
|
||||
run: |
|
||||
set -x
|
||||
|
||||
BETA_COUNT=$(git tag -l --sort=refname "v${{github.event.inputs.version}}-b*" | tail -n1 | sed "s/^\S*-b//g")
|
||||
[ "$BETA_COUNT" = "" ] && BETA_COUNT="1" || BETA_COUNT=$((BETA_COUNT+1))
|
||||
|
||||
echo "VERSION_TAG=v${{github.event.inputs.version}}-b${BETA_COUNT}" >> $GITHUB_ENV
|
||||
|
||||
# NIGHTLY
|
||||
- name: Prepare nightly build
|
||||
if: steps.branch_name.outputs.NAME == 'master' && github.event.inputs.version == ''
|
||||
|
@ -74,9 +90,14 @@ jobs:
|
|||
|
||||
# PROD
|
||||
- name: Build release build and run tests
|
||||
if: startsWith(env.VERSION_TAG, 'v')
|
||||
if: startsWith(env.VERSION_TAG, 'v') && github.event.inputs.beta != 'true'
|
||||
run: ./gradlew assembleStandardRelease testStandardReleaseUnitTest
|
||||
|
||||
# BETA
|
||||
- name: Build release build and run tests
|
||||
if: startsWith(env.VERSION_TAG, 'v') && github.event.inputs.beta == 'true'
|
||||
run: ./gradlew assembleStandardBeta testStandardBetaUnitTest
|
||||
|
||||
# NIGHTLY
|
||||
- name: Build nightly build and run tests
|
||||
if: startsWith(env.VERSION_TAG, 'r')
|
||||
|
@ -104,11 +125,27 @@ jobs:
|
|||
detailed_summary: true
|
||||
report_paths: '**/build/test-results/test*/TEST-*.xml'
|
||||
|
||||
- name: Get version stage
|
||||
id: version_stage
|
||||
shell: bash
|
||||
run: |
|
||||
stage=""
|
||||
case "${{ env.VERSION_TAG }}" in
|
||||
v*)
|
||||
_test=$(echo "${{ env.VERSION_TAG }}" | grep "v*-b")
|
||||
[ "$_test" = "" ] && stage="release" || stage="beta"
|
||||
;;
|
||||
r*) stage="nightly" ;;
|
||||
esac
|
||||
[ "$stage" = "" ] && exit 1 # something went wrong
|
||||
|
||||
echo "STAGE=${stage}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Sign APK
|
||||
uses: null2264/actions/android-signer@102c5b82a95381eeb420bb2d62639d1ff2a3eb1c
|
||||
if: env.VERSION_TAG != ''
|
||||
with:
|
||||
releaseDir: app/build/outputs/apk/standard/${{ startsWith(env.VERSION_TAG, 'v') && 'release' || 'nightly' }}
|
||||
releaseDir: app/build/outputs/apk/standard/${{ steps.version_stage.outputs.STAGE }}
|
||||
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
|
||||
keyAlias: ${{ secrets.ALIAS }}
|
||||
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||
|
@ -120,7 +157,7 @@ jobs:
|
|||
run: |
|
||||
set -e
|
||||
|
||||
dir=app/build/outputs/apk/standard/${{ startsWith(env.VERSION_TAG, 'v') && 'release' || 'nightly' }}
|
||||
dir="app/build/outputs/apk/standard/${{ steps.version_stage.outputs.STAGE }}"
|
||||
|
||||
mv $dir/app-standard-universal-*-signed.apk yokai-${{ env.VERSION_TAG }}.apk
|
||||
sha=`sha256sum yokai-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
||||
|
@ -173,7 +210,7 @@ jobs:
|
|||
yokai-x86-${{ env.VERSION_TAG }}.apk
|
||||
yokai-x86_64-${{ env.VERSION_TAG }}.apk
|
||||
draft: true
|
||||
prerelease: false
|
||||
prerelease: ${{ github.event.inputs.beta }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
|
|
@ -31,6 +31,17 @@ fun runCommand(command: String): String {
|
|||
return String(byteOut.toByteArray()).trim()
|
||||
}
|
||||
|
||||
val versionName = "1.8.5"
|
||||
val betaCount by lazy {
|
||||
val betaTags = runCommand("git tag -l --sort=refname v${versionName}-b*")
|
||||
|
||||
String.format("%02d", if (betaTags.isNotEmpty()) {
|
||||
val betaTag = betaTags.split("\n").last().substringAfter("-b").toIntOrNull()
|
||||
((betaTag ?: 0) + 1)
|
||||
} else {
|
||||
1
|
||||
})
|
||||
}
|
||||
val commitCount by lazy { runCommand("git rev-list --count HEAD") }
|
||||
val commitHash by lazy { runCommand("git rev-parse --short HEAD") }
|
||||
val buildTime: String by lazy {
|
||||
|
@ -44,7 +55,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId = "eu.kanade.tachiyomi"
|
||||
versionCode = 139
|
||||
versionName = "1.8.4.3"
|
||||
versionName = versionName
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled = true
|
||||
|
||||
|
@ -94,7 +105,7 @@ android {
|
|||
buildConfigField("boolean", "BETA", "true")
|
||||
|
||||
matchingFallbacks.add("release")
|
||||
versionNameSuffix = "-b${commitCount}"
|
||||
versionNameSuffix = "-b${betaCount}"
|
||||
}
|
||||
create("nightly") {
|
||||
initWith(getByName("release"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue