149 lines
6.1 KiB
YAML
149 lines
6.1 KiB
YAML
name: Release Builder
|
|
# Build a stable release on a tag newly pushed
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
# Dispatch or Manual triggers
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-app:
|
|
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'komikku-app/komikku'
|
|
name: Build release app
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
VERSION_TAG: ${{ steps.get_tag.outputs.VERSION_TAG }}
|
|
steps:
|
|
- name: Get tag name
|
|
id: get_tag
|
|
run: |
|
|
set -x
|
|
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Clone Repository (${{ steps.get_tag.outputs.VERSION_TAG }})
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Validate Gradle Wrapper
|
|
uses: gradle/actions/wrapper-validation@31ae3562f68c96d481c31bc1a8a55cc1be162f83 # v3.4.1
|
|
|
|
- name: Setup Android SDK
|
|
run: |
|
|
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
|
|
with:
|
|
java-version: 17
|
|
distribution: temurin
|
|
|
|
- name: Write google-services.json
|
|
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
|
|
with:
|
|
path: app/google-services.json
|
|
contents: ${{ secrets.GOOGLE_SERVICES_JSON }}
|
|
write-mode: overwrite
|
|
|
|
- name: Write client_secrets.json
|
|
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
|
|
with:
|
|
path: app/src/main/assets/client_secrets.json
|
|
contents: ${{ secrets.GOOGLE_CLIENT_SECRETS_JSON }}
|
|
write-mode: overwrite
|
|
|
|
- name: Set up gradle
|
|
uses: gradle/actions/setup-gradle@31ae3562f68c96d481c31bc1a8a55cc1be162f83 # v3.4.1
|
|
|
|
- name: Build app and run unit tests
|
|
run: ./gradlew assembleStandardRelease testStandardReleaseUnitTest testReleaseUnitTest --stacktrace
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
|
|
with:
|
|
path: "**/*.apk"
|
|
retention-days: 1
|
|
|
|
release-app:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-app
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
|
with:
|
|
merge-multiple: true
|
|
|
|
- name: Setup Android SDK
|
|
run: |
|
|
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
|
|
|
|
- name: Sign APK
|
|
uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407 # v1
|
|
with:
|
|
releaseDirectory: app/build/outputs/apk/standard/release
|
|
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
|
|
alias: ${{ secrets.ALIAS }}
|
|
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
|
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
|
|
|
- name: Get SHA & clean up build artifacts
|
|
id: get_sha
|
|
run: |
|
|
set -e
|
|
|
|
mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk Komikku-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-${{ needs.build-app.outputs.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_OUTPUT
|
|
|
|
mv app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned-signed.apk Komikku-arm64-v8a-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-arm64-v8a-${{ needs.build-app.outputs.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_OUTPUT
|
|
|
|
mv app/build/outputs/apk/standard/release/app-standard-armeabi-v7a-release-unsigned-signed.apk Komikku-armeabi-v7a-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-armeabi-v7a-${{ needs.build-app.outputs.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_OUTPUT
|
|
|
|
mv app/build/outputs/apk/standard/release/app-standard-x86-release-unsigned-signed.apk Komikku-x86-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-x86-${{ needs.build-app.outputs.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_X86_SHA=$sha" >> $GITHUB_OUTPUT
|
|
|
|
mv app/build/outputs/apk/standard/release/app-standard-x86_64-release-unsigned-signed.apk Komikku-x86_64-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-x86_64-${{ needs.build-app.outputs.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_X86_64_SHA=$sha" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # v2.0.5
|
|
with:
|
|
tag_name: ${{ needs.build-app.outputs.VERSION_TAG }}
|
|
name: Komikku ${{ needs.build-app.outputs.VERSION_TAG }}
|
|
body: |
|
|
---
|
|
|
|
### Checksums
|
|
|
|
| Variant | SHA-256 |
|
|
| ------- | ------- |
|
|
| Universal | ${{ steps.get_sha.outputs.APK_UNIVERSAL_SHA }} |
|
|
| arm64-v8a | ${{ steps.get_sha.outputs.APK_ARM64_V8A_SHA }} |
|
|
| armeabi-v7a | ${{ steps.get_sha.outputs.APK_ARMEABI_V7A_SHA }} |
|
|
| x86 | ${{ steps.get_sha.outputs.APK_X86_SHA }} |
|
|
| x86_64 | ${{ steps.get_sha.outputs.APK_X86_64_SHA }} |
|
|
|
|
## If you are unsure which apk to download then go with Komikku-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
files: |
|
|
Komikku-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
Komikku-arm64-v8a-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
Komikku-armeabi-v7a-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
Komikku-x86-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
Komikku-x86_64-${{ needs.build-app.outputs.VERSION_TAG }}.apk
|
|
draft: true
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|