Remote Dispatch Build App #11
This file contains 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: Remote Dispatch Build App | |
on: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-app: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: "jeryjs/TachiyomiSY-with-discord-RPC" | |
fetch-depth: 0 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Set up gradle | |
uses: gradle/actions/setup-gradle@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: temurin | |
- name: Create Tag | |
run: | | |
git tag "preview-${{ github.run_number }}" | |
git push origin "preview-${{ github.run_number }}" | |
- 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/jeryjs/TachiyomiSY-with-discord-RPC/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: Write Version.kt | |
uses: DamianReeves/[email protected] | |
with: | |
path: app/src/main/java/exh/Version.kt | |
contents: 'package exh const val syDebugVersion: String = "${{ github.run_number }}"' | |
write-mode: overwrite | |
- name: Write changelog_debug.xml | |
uses: DamianReeves/[email protected] | |
with: | |
path: app/src/main/res/raw/changelog_debug.xml | |
contents: "${{ env.CHANGELOG }}" | |
write-mode: overwrite | |
- name: Write google-services.json | |
uses: DamianReeves/[email protected] | |
with: | |
path: app/google-services.json | |
contents: ${{ secrets.GOOGLE_SERVICES_TEXT }} | |
write-mode: overwrite | |
- name: Write client_secrets.json | |
uses: DamianReeves/[email protected] | |
with: | |
path: app/src/main/assets/client_secrets.json | |
contents: ${{ secrets.CLIENT_SECRETS_TEXT }} | |
write-mode: overwrite | |
- name: Build app | |
run: ./gradlew assembleStandardRelease --stacktrace | |
- name: Sign Android Release | |
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 | |
run: | | |
set -e | |
mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk TachiyomiSY-${{ github.run_number }}.apk | |
sha=`sha256sum TachiyomiSY-${{ github.run_number }}.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 TachiyomiSY-arm64-v8a-${{ github.run_number }}.apk | |
sha=`sha256sum TachiyomiSY-arm64-v8a-${{ github.run_number }}.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 TachiyomiSY-armeabi-v7a-${{ github.run_number }}.apk | |
sha=`sha256sum TachiyomiSY-armeabi-v7a-${{ github.run_number }}.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 TachiyomiSY-x86-${{ github.run_number }}.apk | |
sha=`sha256sum TachiyomiSY-x86-${{ github.run_number }}.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 TachiyomiSY-x86_64-${{ github.run_number }}.apk | |
sha=`sha256sum TachiyomiSY-x86_64-${{ github.run_number }}.apk | awk '{ print $1 }'` | |
echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.run_number }} | |
name: TachiyomiSY Dev Build ${{ github.run_number }} | |
body: | | |
### Commits | |
https://github.com/jeryjs/TachiyomiSY-with-discord-RPC/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 }} | | |
files: | | |
TachiyomiSY-${{ github.run_number }}.apk | |
TachiyomiSY-arm64-v8a-${{ github.run_number }}.apk | |
TachiyomiSY-armeabi-v7a-${{ github.run_number }}.apk | |
TachiyomiSY-x86-${{ github.run_number }}.apk | |
TachiyomiSY-x86_64-${{ github.run_number }}.apk | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |