Remote Dispatch Build Preview App #1
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 Preview App | |
on: | |
# Manual triggers | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: Git Ref to build (Optional) | |
required: false | |
dry-run: | |
description: Creates a draft release (any value would create a draft) | |
required: false | |
branch: | |
description: Create preview build (master) or development build (develop) | |
required: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.inputs.git-ref }} | |
cancel-in-progress: true | |
jobs: | |
get-branch-name: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get branch name | |
run: | | |
echo "Ref name: ${{ github.event.inputs.git-ref }}" | |
echo "Branch name: ${{ github.event.inputs.branch }}" | |
# build-app: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Clone Repository (Latest) | |
# uses: actions/checkout@v4 | |
# with: | |
# repository: 'komikku-app/komikku' | |
# fetch-depth: 0 | |
# if: github.event.inputs.git-ref == '' | |
# - name: Clone Repository (Custom Ref) | |
# uses: actions/checkout@v4 | |
# if: github.event.inputs.git-ref != '' | |
# with: | |
# repository: 'komikku-app/komikku' | |
# fetch-depth: 0 | |
# ref: ${{ github.event.inputs.git-ref }} | |
# - 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: Get previous release | |
# id: last_release | |
# uses: InsonusK/get-latest-release@7a9ff16c8c6b7ead5d71c0f1cc61f2703170eade # v1.1.0 | |
# with: | |
# myToken: ${{ github.token }} | |
# exclude_types: "draft|prerelease" | |
# view_top: 1 | |
# - name: Prepare build | |
# run: | | |
# set -e | |
# commit_count=$(git rev-list --count HEAD) | |
# echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV | |
# current_sha=$(git rev-parse --short HEAD) | |
# echo "CURRENT_SHA=$current_sha" >> $GITHUB_ENV | |
# prev_commit_count=$(echo "${{ steps.last_release.outputs.tag_name }}" | sed -e "s/^r//") | |
# commit_count_diff=$(expr $commit_count - $prev_commit_count) | |
# prev_release_sha=$(git rev-parse --short HEAD~$commit_count_diff) | |
# echo "PREV_RELEASE_SHA=$prev_release_sha" >> $GITHUB_ENV | |
# echo "COMMIT_LOGS<<{delimiter} | |
# $(curl -H "Accept: application/vnd.github.v3+json" \ | |
# "https://api.github.com/repos/jobobby04/TachiyomiSY/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 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 APK | |
# run: ./gradlew assembleStandardPreview --stacktrace | |
# - name: Sign APK | |
# uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407 # v1 | |
# with: | |
# releaseDirectory: app/build/outputs/apk/standard/preview | |
# signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
# alias: ${{ secrets.ALIAS }} | |
# keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
# keyPassword: ${{ secrets.KEY_PASSWORD }} | |
# - name: Clean up build artifacts | |
# run: | | |
# set -e | |
# cp app/build/outputs/apk/standard/preview/app-standard-universal-preview-signed.apk mihon-r${{ env.COMMIT_COUNT }}.apk | |
# sha=`sha256sum mihon-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` | |
# echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV | |
# cp app/build/outputs/apk/standard/preview/app-standard-arm64-v8a-preview-signed.apk mihon-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk | |
# sha=`sha256sum mihon-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` | |
# echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV | |
# cp app/build/outputs/apk/standard/preview/app-standard-armeabi-v7a-preview-signed.apk mihon-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk | |
# sha=`sha256sum mihon-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` | |
# echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV | |
# cp app/build/outputs/apk/standard/preview/app-standard-x86-preview-signed.apk mihon-x86-r${{ env.COMMIT_COUNT }}.apk | |
# sha=`sha256sum mihon-x86-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` | |
# echo "APK_X86_SHA=$sha" >> $GITHUB_ENV | |
# cp app/build/outputs/apk/standard/preview/app-standard-x86_64-preview-signed.apk mihon-x86_64-r${{ env.COMMIT_COUNT }}.apk | |
# sha=`sha256sum mihon-x86_64-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` | |
# echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV | |
# - name: Create release | |
# uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2.0.4 | |
# with: | |
# tag_name: r${{ env.COMMIT_COUNT }} | |
# name: Mihon Preview r${{ env.COMMIT_COUNT }} | |
# body: | | |
# ### Commits | |
# https://github.com/mihonapp/mihon/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 apk to download then go with mihon-r${{ env.COMMIT_COUNT }}.apk | |
# files: | | |
# mihon-r${{ env.COMMIT_COUNT }}.apk | |
# mihon-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk | |
# mihon-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk | |
# mihon-x86-r${{ env.COMMIT_COUNT }}.apk | |
# mihon-x86_64-r${{ env.COMMIT_COUNT }}.apk | |
# draft: ${{ github.event.inputs.dry-run != '' }} | |
# prerelease: false | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Prune old releases | |
# uses: dev-drprasad/delete-older-releases@0bf4e6748f08135170c2294f877ba7d9b633b028 # v0.3.3 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# keep_latest: 28 | |
# delete_tags: true |