diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d77fbfc..cf6ccb0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -180,10 +180,8 @@ jobs: VER: ${{ needs.meta.outputs.version }} run: | set -euo pipefail - # 发布正文优先取附注 tag 的 message(剥掉签名块),无附注时回退自动生成 - notes="$(git tag -l --format='%(contents)' "$VER" | sed '/^-----BEGIN PGP SIGNATURE----$/,/^-----END PGP SIGNATURE----$/d' || true)" - notes="$(echo "$notes" | sed -e '/^[[:space:]]*$/d' | sed -e ':a;N;$!ba;s/ -$//')" + # 发布正文优先取附注 tag 的 message(awk 剥掉签名块与空行) + notes="$(git for-each-ref "refs/tags/$VER" --format='%(contents)' | awk '/^-----BEGIN PGP SIGNATURE----$/{sig=1} !sig' | awk 'NF')" if gh release view "$VER" -R "$GITHUB_REPOSITORY" >/dev/null 2>&1; then echo "Release ${VER} 已存在,覆盖上传资产" if [ -n "$notes" ]; then