Skip to content

Commit 56f7e6c

Browse files
authored
Merge c0f41e3 into fe64a8c
2 parents fe64a8c + c0f41e3 commit 56f7e6c

4 files changed

Lines changed: 83 additions & 6 deletions

File tree

.github/workflows/manual-publish.yml

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ on:
1818
required: false
1919
default: false
2020
type: boolean
21+
update_changelog:
22+
description: "Update CHANGELOG.md with release notes"
23+
required: false
24+
default: true
25+
type: boolean
2126

2227
jobs:
2328
publish:
@@ -73,6 +78,68 @@ jobs:
7378
npm version ${{ github.event.inputs.version }} --no-git-tag-version
7479
echo "NEW_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
7580
81+
- name: Get previous release tag
82+
id: prev-tag
83+
run: |
84+
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
85+
echo "tag=$PREV_TAG" >> $GITHUB_OUTPUT
86+
echo "Previous tag: $PREV_TAG"
87+
88+
- name: Generate Changelog
89+
if: github.event.inputs.update_changelog == 'true' && github.event.inputs.dry_run == 'false' && steps.prev-tag.outputs.tag != ''
90+
uses: anthropics/claude-code-action@v1
91+
with:
92+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
93+
prompt: |
94+
Generate a changelog entry for version ${{ env.NEW_VERSION }} (release date: today).
95+
Previous version tag: ${{ steps.prev-tag.outputs.tag }}
96+
97+
## Instructions
98+
99+
1. Get commits since last release:
100+
`git log ${{ steps.prev-tag.outputs.tag }}..HEAD --pretty=format:"%s (%h)" --no-merges`
101+
102+
2. Get merged PRs (for better context):
103+
`gh pr list --state merged --json number,title,body,mergedAt --limit 100`
104+
105+
3. Analyze and categorize changes using these categories (only include sections that have changes):
106+
- **Added** - new features
107+
- **Changed** - changes in existing functionality
108+
- **Deprecated** - soon-to-be removed features
109+
- **Removed** - now removed features
110+
- **Fixed** - bug fixes
111+
- **Security** - vulnerability fixes
112+
113+
4. Update CHANGELOG.md by inserting the new version entry AFTER the `## [Unreleased]` line.
114+
115+
## Important Rules
116+
117+
- **EXCLUDE** any commits/PRs related to:
118+
- Changelog updates (commits mentioning "changelog", "CHANGELOG")
119+
- Version bumps (commits like "chore: bump version to X.X.X")
120+
- Release commits (commits like "chore: release vX.X.X")
121+
- Be concise but descriptive - focus on user-facing changes
122+
- Include PR numbers in parentheses when available, e.g., "Added foo feature (#123)"
123+
- Follow keepachangelog.com format exactly
124+
- Use ISO date format: YYYY-MM-DD
125+
126+
## Example Output Format
127+
128+
```markdown
129+
## [0.0.8] - 2026-01-19
130+
131+
### Added
132+
- Non-interactive mode for `create` command (#67)
133+
134+
### Changed
135+
- Improved intro/outro alignment across all commands (#61)
136+
137+
### Fixed
138+
- Various small fixes and improvements (#60)
139+
```
140+
141+
claude_args: '--allowed-tools "Bash(git log:*),Bash(git diff:*),Bash(gh pr:*),Read,Write"'
142+
76143
- name: Build package
77144
run: npm run build
78145

@@ -99,7 +166,11 @@ jobs:
99166
git config --local user.email "action@github.com"
100167
git config --local user.name "GitHub Action"
101168
git add package.json package-lock.json
102-
git commit -m "chore: bump version to ${{ env.NEW_VERSION }}"
169+
# Add CHANGELOG.md only if changelog update was requested
170+
if [[ "${{ github.event.inputs.update_changelog }}" == "true" ]]; then
171+
git add CHANGELOG.md
172+
fi
173+
git commit -m "chore: release v${{ env.NEW_VERSION }}"
103174
git tag v${{ env.NEW_VERSION }}
104175
git push origin HEAD:${{ github.ref }}
105176
git push origin v${{ env.NEW_VERSION }}
@@ -131,4 +202,5 @@ jobs:
131202
permissions:
132203
contents: write
133204
packages: write
205+
pull-requests: read
134206
id-token: write

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [Unreleased]

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"ky": "^1.14.2",
5656
"lodash.kebabcase": "^4.1.1",
5757
"p-wait-for": "^6.0.0",
58-
"tar": "^7.4.3",
58+
"tar": "^7.5.3",
5959
"tsdown": "^0.12.4",
6060
"tsx": "^4.19.2",
6161
"typescript": "^5.7.2",

0 commit comments

Comments
 (0)