Skip to content

Commit 7607474

Browse files
author
dev
committed
ci: use the annotated tag message as release notes
fetch-depth: 0 so the tag object is available on the runner.
1 parent 53c7d11 commit 7607474

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
1820

1921
- name: Set up JDK 21
2022
uses: actions/setup-java@v4
@@ -97,6 +99,11 @@ jobs:
9799
env:
98100
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99101
run: |
100-
gh release create "$GITHUB_REF_NAME" \
101-
NekoBoxForAndroid/app/build/outputs/apk/oss/release/*arm64-v8a.apk \
102-
--title "$GITHUB_REF_NAME" --generate-notes
102+
APK=NekoBoxForAndroid/app/build/outputs/apk/oss/release/*arm64-v8a.apk
103+
# 用 annotated tag 的说明作为 Release 正文;没写说明就退回自动生成
104+
BODY="$(git tag -l --format='%(contents:body)' "$GITHUB_REF_NAME")"
105+
if [ -n "$(echo "$BODY" | tr -d '[:space:]')" ]; then
106+
gh release create "$GITHUB_REF_NAME" $APK --title "$GITHUB_REF_NAME" --notes "$BODY"
107+
else
108+
gh release create "$GITHUB_REF_NAME" $APK --title "$GITHUB_REF_NAME" --generate-notes
109+
fi

0 commit comments

Comments
 (0)