Skip to content

Commit c2ac09a

Browse files
committed
use a shared script (scripts/generate-changelog.sh) to generate changelogs for tags
1 parent 51ed77c commit c2ac09a

4 files changed

Lines changed: 82 additions & 43 deletions

File tree

.github/workflows/release-cli.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,7 @@ jobs:
133133
- name: Generate changelog
134134
id: changelog
135135
run: |
136-
TAG="${{ steps.version.outputs.tag }}"
137-
echo "## What's Changed" > changelog.md
138-
echo "" >> changelog.md
139-
140-
# Get the previous tag
141-
PREV_TAG=$(git describe --tags --abbrev=0 $TAG^ 2>/dev/null || echo "")
142-
143-
if [ -n "$PREV_TAG" ]; then
144-
echo "### Commits since $PREV_TAG" >> changelog.md
145-
git log --pretty=format:"- %s (%h)" $PREV_TAG..$TAG >> changelog.md
146-
else
147-
echo "### Initial Release" >> changelog.md
148-
echo "- First release of Renamify" >> changelog.md
149-
fi
150-
151-
echo "" >> changelog.md
136+
./scripts/generate-changelog.sh cli "${{ steps.version.outputs.version }}" > changelog.md
152137
echo "## Installation" >> changelog.md
153138
echo "" >> changelog.md
154139
echo "### macOS (Intel)" >> changelog.md

.github/workflows/release-mcp.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,28 @@ jobs:
6868
env:
6969
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7070

71+
- name: Generate changelog
72+
id: changelog
73+
run: |
74+
./scripts/generate-changelog.sh mcp "${{ steps.version.outputs.version }}" > changelog.md
75+
echo "## Installation" >> changelog.md
76+
echo "" >> changelog.md
77+
echo "Install via npm:" >> changelog.md
78+
echo '```bash' >> changelog.md
79+
echo "npm install -g @renamify/mcp-server" >> changelog.md
80+
echo '```' >> changelog.md
81+
echo "" >> changelog.md
82+
echo "Or use with npx:" >> changelog.md
83+
echo '```bash' >> changelog.md
84+
echo "npx @renamify/mcp-server" >> changelog.md
85+
echo '```' >> changelog.md
86+
7187
- name: Create GitHub Release
7288
uses: softprops/action-gh-release@v1
7389
if: github.event_name == 'push'
7490
with:
7591
tag_name: mcp-v${{ steps.version.outputs.version }}
7692
name: MCP Server v${{ steps.version.outputs.version }}
77-
body: |
78-
## Renamify MCP Server v${{ steps.version.outputs.version }}
79-
80-
Install via npm:
81-
```bash
82-
npm install -g renamify-mcp
83-
```
84-
85-
Or use with npx:
86-
```bash
87-
npx renamify-mcp
88-
```
93+
body_path: changelog.md
8994
env:
9095
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-vscode.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,32 @@ jobs:
7373
working-directory: renamify-vscode
7474
run: npx vsce publish --no-dependencies --packagePath *.vsix -p ${{ secrets.VSCE_TOKEN }}
7575

76+
- name: Generate changelog
77+
id: changelog
78+
run: |
79+
./scripts/generate-changelog.sh vscode "${{ steps.version.outputs.version }}" > changelog.md
80+
echo "## Installation" >> changelog.md
81+
echo "" >> changelog.md
82+
echo "Install from VS Code Marketplace or download the VSIX file below." >> changelog.md
83+
echo "" >> changelog.md
84+
echo "### From VS Code" >> changelog.md
85+
echo "- Open VS Code" >> changelog.md
86+
echo "- Go to Extensions (Ctrl+Shift+X)" >> changelog.md
87+
echo '- Search for "Renamify"' >> changelog.md
88+
echo "- Click Install" >> changelog.md
89+
echo "" >> changelog.md
90+
echo "### Manual VSIX Installation" >> changelog.md
91+
echo '```bash' >> changelog.md
92+
echo "code --install-extension renamify-*.vsix" >> changelog.md
93+
echo '```' >> changelog.md
94+
7695
- name: Create GitHub Release
7796
uses: softprops/action-gh-release@v1
7897
if: github.event_name == 'push'
7998
with:
8099
tag_name: vscode-v${{ steps.version.outputs.version }}
81100
name: VS Code Extension v${{ steps.version.outputs.version }}
82101
files: renamify-vscode/*.vsix
83-
body: |
84-
## Renamify VS Code Extension v${{ steps.version.outputs.version }}
85-
86-
Install from VS Code Marketplace or download the VSIX file below.
87-
88-
### Installation
89-
- Open VS Code
90-
- Go to Extensions (Ctrl+Shift+X)
91-
- Search for "Renamify"
92-
- Click Install
93-
94-
Or install the VSIX manually:
95-
```bash
96-
code --install-extension renamify-*.vsix
97-
```
102+
body_path: changelog.md
98103
env:
99104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

scripts/generate-changelog.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Generate changelog for a release based on tag prefix
4+
# Usage: ./generate-changelog.sh <prefix> <version>
5+
# Example: ./generate-changelog.sh cli 0.1.1
6+
7+
set -e
8+
9+
PREFIX=$1
10+
VERSION=$2
11+
12+
if [ -z "$PREFIX" ] || [ -z "$VERSION" ]; then
13+
echo "Usage: $0 <prefix> <version>"
14+
echo "Example: $0 cli 0.1.1"
15+
exit 1
16+
fi
17+
18+
TAG="${PREFIX}-v${VERSION}"
19+
20+
# Check if the target tag exists
21+
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
22+
echo "Error: Tag '$TAG' does not exist" >&2
23+
echo "Please create the tag first or check the version number" >&2
24+
exit 1
25+
fi
26+
27+
echo "## What's Changed"
28+
echo ""
29+
30+
# Get the previous tag with same prefix (need to fetch all tags first)
31+
git fetch --tags >/dev/null 2>&1
32+
PREV_TAG=$(git tag -l "${PREFIX}-v*" --sort=-version:refname | grep -v "^${TAG}$" | head -n 1)
33+
34+
if [ -n "$PREV_TAG" ]; then
35+
echo "### Commits since $PREV_TAG"
36+
git log --pretty=format:"- %s (%h)" "$PREV_TAG..$TAG"
37+
else
38+
echo "### Commits"
39+
# Show last 10 commits up to current tag if no previous tag
40+
git log --pretty=format:"- %s (%h)" -n 10 "$TAG"
41+
fi
42+
43+
echo ""
44+
echo ""

0 commit comments

Comments
 (0)