2020-09-12 17:47:09 +02:00
|
|
|
name: Build job
|
|
|
|
|
|
|
|
on:
|
2021-01-23 23:14:38 +01:00
|
|
|
# Every Saturday at 21:00 UTC
|
2020-09-12 17:47:09 +02:00
|
|
|
schedule:
|
|
|
|
- cron: '0 21 * * 6'
|
|
|
|
# Manual triggers
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
git-ref:
|
|
|
|
description: Git Ref (Optional)
|
|
|
|
required: false
|
2020-09-23 03:39:12 +02:00
|
|
|
dry-run:
|
|
|
|
description: Creates a draft release
|
|
|
|
required: false
|
2020-09-12 17:47:09 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-app:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Clone Repository (Latest)
|
2023-09-22 20:59:37 +02:00
|
|
|
uses: actions/checkout@v4
|
2020-09-12 17:47:09 +02:00
|
|
|
with:
|
2020-12-27 20:58:07 +01:00
|
|
|
repository: 'tachiyomiorg/tachiyomi'
|
2020-09-12 17:47:09 +02:00
|
|
|
fetch-depth: 0
|
|
|
|
if: github.event.inputs.git-ref == ''
|
|
|
|
- name: Clone Repository (Custom Ref)
|
2023-09-22 20:59:37 +02:00
|
|
|
uses: actions/checkout@v4
|
2020-09-12 17:47:09 +02:00
|
|
|
if: github.event.inputs.git-ref != ''
|
|
|
|
with:
|
2020-12-27 20:58:07 +01:00
|
|
|
repository: 'tachiyomiorg/tachiyomi'
|
2020-09-12 17:47:09 +02:00
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ github.event.inputs.git-ref }}
|
|
|
|
|
2021-08-18 04:42:27 +02:00
|
|
|
- name: Set up JDK
|
2022-05-15 18:11:30 +02:00
|
|
|
uses: actions/setup-java@v3
|
2020-09-12 17:47:09 +02:00
|
|
|
with:
|
2023-04-16 23:58:27 +02:00
|
|
|
java-version: 17
|
2022-05-15 18:11:30 +02:00
|
|
|
distribution: adopt
|
2020-09-12 17:47:09 +02:00
|
|
|
|
2021-01-23 23:14:38 +01:00
|
|
|
- name: Get previous release
|
|
|
|
id: last_release
|
2023-07-06 23:37:18 +02:00
|
|
|
uses: InsonusK/get-latest-release@v1.1.0
|
2021-01-23 23:14:38 +01:00
|
|
|
with:
|
|
|
|
myToken: ${{ github.token }}
|
|
|
|
exclude_types: "draft|prerelease"
|
|
|
|
view_top: 1
|
|
|
|
|
2021-08-18 04:42:27 +02:00
|
|
|
- name: Prepare build
|
2021-01-23 23:14:38 +01:00
|
|
|
run: |
|
2021-06-14 23:34:54 +02:00
|
|
|
set -e
|
2021-01-23 23:14:38 +01:00
|
|
|
|
|
|
|
commit_count=$(git rev-list --count HEAD)
|
|
|
|
echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV
|
2021-01-24 17:03:45 +01:00
|
|
|
current_sha=$(git rev-parse --short HEAD)
|
|
|
|
echo "CURRENT_SHA=$current_sha" >> $GITHUB_ENV
|
2021-01-23 23:14:38 +01:00
|
|
|
|
|
|
|
prev_commit_count=$(echo "${{ steps.last_release.outputs.tag_name }}" | sed -e "s/^r//")
|
|
|
|
commit_count_diff=$(expr $commit_count - $prev_commit_count)
|
2021-01-24 17:03:45 +01:00
|
|
|
prev_release_sha=$(git rev-parse --short HEAD~$commit_count_diff)
|
|
|
|
echo "PREV_RELEASE_SHA=$prev_release_sha" >> $GITHUB_ENV
|
2021-01-23 23:14:38 +01:00
|
|
|
|
|
|
|
echo "COMMIT_LOGS<<{delimiter}
|
2021-01-24 17:03:45 +01:00
|
|
|
$(curl -H "Accept: application/vnd.github.v3+json" \
|
|
|
|
"https://api.github.com/repos/tachiyomiorg/tachiyomi/compare/$prev_release_sha...$current_sha" \
|
|
|
|
| jq '[.commits[]|{message:(.commit.message | split("\n")), username:.author.login}]' \
|
|
|
|
| jq -r '.[]|"- \(.message | first) (@\(.username))"')
|
2021-01-23 23:14:38 +01:00
|
|
|
{delimiter}" >> $GITHUB_ENV
|
|
|
|
|
2020-09-12 17:47:09 +02:00
|
|
|
- name: Build APK
|
2021-11-29 01:07:51 +01:00
|
|
|
uses: gradle/gradle-command-action@v2
|
2020-10-10 22:43:52 +02:00
|
|
|
with:
|
2021-10-09 16:29:17 +02:00
|
|
|
arguments: assembleStandardPreview
|
2021-06-14 23:34:54 +02:00
|
|
|
|
2023-08-16 04:16:36 +02:00
|
|
|
- name: Sign APK
|
|
|
|
uses: r0adkll/sign-android-release@v1
|
|
|
|
with:
|
|
|
|
releaseDirectory: app/build/outputs/apk/standard/preview
|
|
|
|
signingKeyBase64: ${{ secrets.DEBUG_KEYSTORE }}
|
|
|
|
alias: androiddebugkey
|
|
|
|
keyStorePassword: android
|
|
|
|
|
2021-03-14 22:38:02 +01:00
|
|
|
- name: Clean up build artifacts
|
|
|
|
run: |
|
2021-06-14 23:34:54 +02:00
|
|
|
set -e
|
2021-06-01 15:55:51 +02:00
|
|
|
|
2023-08-16 04:16:36 +02:00
|
|
|
cp app/build/outputs/apk/standard/preview/app-standard-universal-preview-signed.apk tachiyomi-r${{ env.COMMIT_COUNT }}.apk
|
2021-08-22 17:34:02 +02:00
|
|
|
sha=`sha256sum tachiyomi-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'`
|
|
|
|
echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV
|
2021-06-01 15:55:51 +02:00
|
|
|
|
2023-08-16 04:16:36 +02:00
|
|
|
cp app/build/outputs/apk/standard/preview/app-standard-arm64-v8a-preview-signed.apk tachiyomi-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk
|
2021-08-22 17:34:02 +02:00
|
|
|
sha=`sha256sum tachiyomi-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'`
|
|
|
|
echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV
|
2021-06-01 15:55:51 +02:00
|
|
|
|
2023-08-16 04:16:36 +02:00
|
|
|
cp app/build/outputs/apk/standard/preview/app-standard-armeabi-v7a-preview-signed.apk tachiyomi-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk
|
2021-08-22 17:34:02 +02:00
|
|
|
sha=`sha256sum tachiyomi-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'`
|
|
|
|
echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV
|
2021-06-01 15:55:51 +02:00
|
|
|
|
2023-08-16 04:16:36 +02:00
|
|
|
cp app/build/outputs/apk/standard/preview/app-standard-x86-preview-signed.apk tachiyomi-x86-r${{ env.COMMIT_COUNT }}.apk
|
2021-08-22 17:34:02 +02:00
|
|
|
sha=`sha256sum tachiyomi-x86-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'`
|
|
|
|
echo "APK_X86_SHA=$sha" >> $GITHUB_ENV
|
2020-09-12 17:47:09 +02:00
|
|
|
|
2023-08-16 04:16:36 +02:00
|
|
|
cp app/build/outputs/apk/standard/preview/app-standard-x86_64-preview-signed.apk tachiyomi-x86_64-r${{ env.COMMIT_COUNT }}.apk
|
2022-08-28 15:45:59 +02:00
|
|
|
sha=`sha256sum tachiyomi-x86_64-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'`
|
|
|
|
echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV
|
|
|
|
|
2021-06-14 23:34:54 +02:00
|
|
|
- name: Create release
|
2021-03-14 22:38:02 +01:00
|
|
|
uses: softprops/action-gh-release@v1
|
2020-09-12 17:47:09 +02:00
|
|
|
with:
|
|
|
|
tag_name: r${{ env.COMMIT_COUNT }}
|
2021-03-14 22:38:02 +01:00
|
|
|
name: Tachiyomi Preview r${{ env.COMMIT_COUNT }}
|
2021-01-23 23:14:38 +01:00
|
|
|
body: |
|
2021-08-22 17:34:02 +02:00
|
|
|
### Commits
|
2020-09-23 03:39:12 +02:00
|
|
|
|
2021-08-22 17:34:02 +02:00
|
|
|
https://github.com/tachiyomiorg/tachiyomi/compare/${{ env.PREV_RELEASE_SHA }}...${{ env.CURRENT_SHA }}
|
2021-06-01 15:55:51 +02:00
|
|
|
|
2021-01-23 23:14:38 +01:00
|
|
|
${{ env.COMMIT_LOGS }}
|
2021-03-14 22:38:02 +01:00
|
|
|
|
2021-06-01 15:55:51 +02:00
|
|
|
---
|
|
|
|
|
2021-08-28 23:16:09 +02:00
|
|
|
### Checksums
|
2021-08-22 17:34:02 +02:00
|
|
|
|
2021-08-28 23:16:09 +02:00
|
|
|
| Variant | SHA-256 |
|
|
|
|
| ------- | ------- |
|
2021-08-22 17:34:02 +02:00
|
|
|
| Universal | ${{ env.APK_UNIVERSAL_SHA }}
|
|
|
|
| arm64-v8a | ${{ env.APK_ARM64_V8A_SHA }}
|
|
|
|
| armeabi-v7a | ${{ env.APK_ARMEABI_V7A_SHA }}
|
|
|
|
| x86 | ${{ env.APK_X86_SHA }} |
|
2022-08-28 15:45:59 +02:00
|
|
|
| x86_64 | ${{ env.APK_X86_64_SHA }} |
|
2021-03-14 22:38:02 +01:00
|
|
|
files: |
|
|
|
|
tachiyomi-r${{ env.COMMIT_COUNT }}.apk
|
2021-06-01 15:55:51 +02:00
|
|
|
tachiyomi-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk
|
|
|
|
tachiyomi-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk
|
|
|
|
tachiyomi-x86-r${{ env.COMMIT_COUNT }}.apk
|
2022-08-28 15:45:59 +02:00
|
|
|
tachiyomi-x86_64-r${{ env.COMMIT_COUNT }}.apk
|
2020-09-23 03:39:12 +02:00
|
|
|
draft: ${{ github.event.inputs.dry-run != '' }}
|
2020-09-12 17:47:09 +02:00
|
|
|
prerelease: false
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-01-23 23:14:38 +01:00
|
|
|
|
2020-12-14 03:06:00 +01:00
|
|
|
- name: Prune old releases
|
2023-09-28 00:01:37 +02:00
|
|
|
uses: dev-drprasad/delete-older-releases@v0.3.0
|
2020-12-12 22:26:46 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2022-01-09 17:44:35 +01:00
|
|
|
keep_latest: 28
|
2020-12-12 22:26:46 +01:00
|
|
|
delete_tags: true
|
2023-09-04 00:05:49 +02:00
|
|
|
|
|
|
|
update-website:
|
|
|
|
needs: [build-app]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Trigger Netlify build hook
|
|
|
|
run: curl -s -X POST -d {} "https://api.netlify.com/build_hooks/${TOKEN}"
|
|
|
|
env:
|
|
|
|
TOKEN: ${{ secrets.NETLIFY_HOOK_RELEASE }}
|