From a92af99448b87a8a9cfcd6df4d199ee4be5019e0 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Thu, 23 Apr 2026 22:44:02 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=20GitHub=20Release=20?= =?UTF-8?q?=E5=92=8C=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=20changelog=20?= =?UTF-8?q?=E5=88=B0=E5=8F=91=E5=B8=83=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish-npm.yml | 36 ++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 3d84b0c28..3b1111ebe 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -6,8 +6,9 @@ on: - 'v*' permissions: - contents: read + contents: write packages: write + id-token: write jobs: publish: @@ -51,3 +52,36 @@ jobs: npm publish --tag "$TAG" --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Generate changelog + id: changelog + run: | + PREV_TAG=$(git tag --sort=-version:refname | head -2 | tail -1) + if [ "$PREV_TAG" = "$GITHUB_REF_NAME" ]; then + PREV_TAG="" + fi + + if [ -n "$PREV_TAG" ]; then + COMMITS=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h)" --no-merges) + else + COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges -20) + fi + + { + echo "commits<> "$GITHUB_OUTPUT" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + name: ${{ github.ref_name }} + body: | + ## What's Changed + + ${{ steps.changelog.outputs.commits }} + + **Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.ref_name }}^...${{ github.ref_name }} + draft: false + prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}