Make Pre-release #26
Workflow file for this run
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: Make Pre-release | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: Creates a draft release | |
required: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
cache: 'gradle' | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Build with Gradle | |
run: ./gradlew assemblePreview | |
- name: Sign apk | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/apk/preview | |
signingKeyBase64: ${{ secrets.SIGNING_KEYSTORE }} | |
alias: ${{ secrets.SIGNING_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- name: Prepare release | |
run: | | |
set -e | |
echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV | |
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
echo "CURRENT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
prev_commit_count=$(echo "${{ steps.last_release.outputs.tag_name }}" | sed -e "s/^r//") | |
commit_count_diff=$(expr ${{ env.COMMIT_COUNT }} - $prev_commit_count) | |
commit_count_diff_plus_one=$(expr $commit_count_diff + 1) | |
prev_release_sha=$(git log --topo-order -n $commit_count_diff --skip $commit_count_diff --max-count 1 --pretty=format:"%H") | |
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/aniyomiorg/aniyomi/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: Copy build artifacts | |
run: | | |
set -e | |
declare -a apks=("universal" "arm64-v8a" "armeabi-v7a" "x86" "x86_64") | |
printf "%s\n" "${apks[@]}" | xargs -n 1 -I {} sh -c ' | |
cp app/build/outputs/apk/preview/app-{}-preview-signed.apk mpvKt-{}-r${{ env.COMMIT_COUNT }}.apk | |
sha=$(sha256sum mpvKt-{}-r${{ env.COMMIT_COUNT }}.apk | awk '\''{ print $1 }'\'') | |
echo "apk-{}-sha256=$sha" >> $GITHUB_ENV' | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: r${{ env.COMMIT_COUNT }} | |
name: mpvKt Preview r${{ env.COMMIT_COUNT }} | |
body: | | |
### Commits | |
https://github.com/aniyomiorg/aniyomi/compare/${{ env.PREV_RELEASE_SHA }}...${{ env.CURRENT_SHA }} | |
${{ env.COMMIT_LOGS }} | |
--- | |
### Checksums | |
| Variant | SHA-256 | | |
| ------- | ------- | | |
| Universal | ${{ env.apk-universal-sha256 }} | |
| arm64-v8a | ${{ env.apk-arm64-v8a-sha256 }} | |
| armeabi-v7a | ${{ env.apk-armeabi-v7a-sha256 }} | |
| x86 | ${{ env.apk-x86-sha256 }} | |
| x86_64 | ${{ env.apk-x86_64-sha256 }} | | |
files: | | |
mpvKt-universal-r${{ env.COMMIT_COUNT }}.apk | |
mpvKt-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk | |
mpvKt-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk | |
mpvKt-x86-r${{ env.COMMIT_COUNT }}.apk | |
mpvKt-x86_64-r${{ env.COMMIT_COUNT }}.apk | |
draft: ${{ github.event.inputs.dry-run != '' }} | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |