Write commit history to release body

This commit is contained in:
arkon 2021-01-23 17:14:38 -05:00 committed by arkon
parent add165f44e
commit d97baea8fc

View File

@ -1,7 +1,7 @@
name: Build job
on:
# Every Saturday at 16:00 UTC-5
# Every Saturday at 21:00 UTC
schedule:
- cron: '0 21 * * 6'
# Manual triggers
@ -37,6 +37,30 @@ jobs:
with:
java-version: 11
- name: Get previous release
id: last_release
uses: InsonusK/get-latest-release@v1.0.1
with:
myToken: ${{ github.token }}
exclude_types: "draft|prerelease"
view_top: 1
- name: Set env variables
run: |
set -x
commit_count=$(git rev-list --count HEAD)
echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV
echo "CURRENT_SHA=$(git rev-parse --short HEAD)" >> $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)
echo "PREV_RELEASE_SHA=$(git rev-parse --short HEAD~$commit_count_diff)" >> $GITHUB_ENV
echo "COMMIT_LOGS<<{delimiter}
$(git log HEAD~$commit_count_diff..HEAD --reverse --pretty=format:'- %s (@%an)')
{delimiter}" >> $GITHUB_ENV
- name: Set up keystore
run: mkdir -p ~/.android/ && echo "${{ secrets.DEBUG_KEYSTORE }}" | base64 --decode > ~/.android/debug.keystore
- name: Build APK
@ -46,11 +70,6 @@ jobs:
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
- name: Set env variables
run: |
set -x
echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
echo "CURRENT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Create GitHub release
id: create_release
@ -60,10 +79,10 @@ jobs:
with:
tag_name: r${{ env.COMMIT_COUNT }}
release_name: Tachiyomi Preview r${{ env.COMMIT_COUNT }}
body: >
r${{ env.COMMIT_COUNT }}
body: |
Commits: https://github.com/tachiyomiorg/tachiyomi/compare/${{ env.PREV_RELEASE_SHA }}...${{ env.CURRENT_SHA }}
Latest commit: https://github.com/tachiyomiorg/tachiyomi/commit/${{ env.CURRENT_SHA }}
${{ env.COMMIT_LOGS }}
draft: ${{ github.event.inputs.dry-run != '' }}
prerelease: false
- name: Upload APK to release
@ -75,7 +94,7 @@ jobs:
asset_path: app/build/outputs/apk/standard/debug/app-standard-debug.apk
asset_name: tachiyomi-r${{ env.COMMIT_COUNT }}.apk
asset_content_type: application/vnd.android.package-archive
- name: Prune old releases
uses: dev-drprasad/delete-older-releases@v0.2.0
env: