172 lines
6.9 KiB
YAML
172 lines
6.9 KiB
YAML
name: Release Builder
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build release app
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Clone repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Prepare build
|
|
run: |
|
|
set -e
|
|
|
|
git fetch --tags
|
|
|
|
prev_release_sha=$(git log --oneline --decorate --tags --no-walk --pretty='%C(auto)%h' | head -n 2 | tail -1)
|
|
echo "PREV_RELEASE_SHA=$prev_release_sha" >> $GITHUB_ENV
|
|
|
|
current_sha=$(git log --oneline --decorate --tags --no-walk --pretty='%C(auto)%h' | head -n 1)
|
|
echo "CURRENT_SHA=$current_sha" >> $GITHUB_ENV
|
|
|
|
echo "COMMIT_LOGS<<{delimiter}
|
|
$(curl -H "Accept: application/vnd.github.v3+json" \
|
|
"https://api.github.com/repos/komikku-app/komikku/compare/$prev_release_sha...$current_sha" \
|
|
| jq '[.commits[]|{message:(.commit.message | split("\n")), username:.author.login}]' \
|
|
| jq -r '.[]|"- \(.message | first) (@\(.username))"')
|
|
{delimiter}" >> $GITHUB_ENV
|
|
|
|
- name: Set CHANGELOG
|
|
run: |
|
|
changelog="$(git log ${{ env.PREV_RELEASE_SHA }}..${{ env.CURRENT_SHA }} --pretty=format:'{{changelogtext}}%s (@%an){{!changelogtext}}')"
|
|
changelog="${changelog//$'%'/%25}"
|
|
changelog="${changelog//$'\n'/}"
|
|
changelog="${changelog//$'\r'/}"
|
|
changelog="${changelog//$'<'/}"
|
|
changelog="${changelog//$'>'/}"
|
|
changelog="${changelog//$'&'/}"
|
|
changelog="$(echo $changelog | sed -e 's/{{changelogtext}}/<changelogtext>/g')"
|
|
changelog="$(echo $changelog | sed -e 's/{{!changelogtext}}/<\/changelogtext>/g')"
|
|
changelog="<?xml version=\"1.0\" encoding=\"utf-8\"?><changelog bulletedList=\"true\"><changelogversion versionName=\"${{ github.run_number }}\" changeDate=\"\">$changelog</changelogversion></changelog>"
|
|
echo "CHANGELOG=$changelog" >> $GITHUB_ENV
|
|
|
|
- name: Validate Gradle Wrapper
|
|
uses: gradle/wrapper-validation-action@v3
|
|
|
|
- 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@v4
|
|
with:
|
|
java-version: 17
|
|
distribution: adopt
|
|
|
|
- name: Set up gradle
|
|
uses: gradle/actions/setup-gradle@v3
|
|
|
|
# SY <--
|
|
- name: Write google-services.json
|
|
uses: DamianReeves/write-file-action@v1.3
|
|
with:
|
|
path: app/google-services.json
|
|
contents: ${{ secrets.GOOGLE_SERVICES_TEXT }}
|
|
write-mode: overwrite
|
|
|
|
- name: Write client_secrets.json
|
|
uses: DamianReeves/write-file-action@v1.3
|
|
with:
|
|
path: app/src/main/assets/client_secrets.json
|
|
contents: ${{ secrets.CLIENT_SECRETS_TEXT }}
|
|
write-mode: overwrite
|
|
# SY -->
|
|
|
|
- name: Build app and run unit tests
|
|
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'komikku-app/komikku'
|
|
run: ./gradlew assembleStandardRelease testStandardReleaseUnitTest --stacktrace
|
|
|
|
# Sign APK and create release for tags
|
|
- name: Get tag name
|
|
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'komikku-app/komikku'
|
|
run: |
|
|
set -x
|
|
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
|
|
|
|
- name: Sign APK
|
|
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'komikku-app/komikku'
|
|
uses: r0adkll/sign-android-release@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: Clean up build artifacts
|
|
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'komikku-app/komikku'
|
|
run: |
|
|
set -e
|
|
|
|
mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk Komikku-${{ env.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV
|
|
|
|
cp app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned-signed.apk Komikku-arm64-v8a-${{ env.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-arm64-v8a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV
|
|
|
|
cp app/build/outputs/apk/standard/release/app-standard-armeabi-v7a-release-unsigned-signed.apk Komikku-armeabi-v7a-${{ env.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-armeabi-v7a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV
|
|
|
|
cp app/build/outputs/apk/standard/release/app-standard-x86-release-unsigned-signed.apk Komikku-x86-${{ env.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-x86-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_X86_SHA=$sha" >> $GITHUB_ENV
|
|
|
|
cp app/build/outputs/apk/standard/release/app-standard-x86_64-release-unsigned-signed.apk Komikku-x86_64-${{ env.VERSION_TAG }}.apk
|
|
sha=`sha256sum Komikku-x86_64-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
|
|
echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV
|
|
|
|
- name: Create release
|
|
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'komikku-app/komikku'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ env.VERSION_TAG }}
|
|
name: Komikku ${{ env.VERSION_TAG }}
|
|
body: |
|
|
Change logs:
|
|
|
|
${{ env.CHANGE_LOGS }}
|
|
|
|
### Commits
|
|
|
|
https://github.com/komikku-app/komikku/compare/${{ env.PREV_RELEASE_SHA }}...${{ env.CURRENT_SHA }}
|
|
|
|
${{ env.COMMIT_LOGS }}
|
|
|
|
---
|
|
|
|
### 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 }} |
|
|
|
|
## If you are unsure which version to choose then go with Komikku-${{ env.VERSION_TAG }}.apk
|
|
files: |
|
|
Komikku-${{ env.VERSION_TAG }}.apk
|
|
Komikku-arm64-v8a-${{ env.VERSION_TAG }}.apk
|
|
Komikku-armeabi-v7a-${{ env.VERSION_TAG }}.apk
|
|
Komikku-x86-${{ env.VERSION_TAG }}.apk
|
|
Komikku-x86_64-${{ env.VERSION_TAG }}.apk
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|