Skip to content

Commit 0d4c90e

Browse files
committed
Fix changelog and release duplication issue
1 parent c8e543b commit 0d4c90e

2 files changed

Lines changed: 10 additions & 27 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,18 @@ jobs:
135135
echo "Version v${{ steps.bump_version.outputs.new_version }} already exists in CHANGELOG.md, skipping update"
136136
else
137137
# Prepare new entry
138-
cat > /tmp/new_entry.md <<EOF
139-
## [v${{ steps.bump_version.outputs.new_version }}] - $(date +%Y-%m-%d)
140-
141-
EOF
142-
138+
echo "## [v${{ steps.bump_version.outputs.new_version }}] - $(date +%Y-%m-%d)" > /tmp/new_entry.md
139+
echo "" >> /tmp/new_entry.md
143140
cat /tmp/changelog.md | tail -n +3 >> /tmp/new_entry.md
144141
echo "" >> /tmp/new_entry.md
145142
146-
# Insert after the header
147-
sed -i '1,/^All notable/r /tmp/new_entry.md' CHANGELOG.md || {
148-
# If sed fails (no header found), just prepend
149-
cat /tmp/new_entry.md CHANGELOG.md > /tmp/new_changelog.md
150-
mv /tmp/new_changelog.md CHANGELOG.md
151-
}
143+
# Split CHANGELOG into header and content
144+
awk '/^All notable changes/{print; print ""; exit}' CHANGELOG.md > /tmp/header.md
145+
awk '/^All notable changes/{found=1; next} found' CHANGELOG.md > /tmp/content.md
146+
147+
# Rebuild CHANGELOG with new entry inserted
148+
cat /tmp/header.md /tmp/new_entry.md /tmp/content.md > CHANGELOG.md
149+
152150
echo "Added v${{ steps.bump_version.outputs.new_version }} to CHANGELOG.md"
153151
fi
154152

CHANGELOG.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
# Changelog
2-
## [v2.3.1] - 2026-01-30
3-
4-
### 🔧 Chore
5-
6-
- chore: update dependencies and GitHub Actions to latest versions (456df59)
7-
8-
9-
10-
## [v2.3.1] - 2026-01-30
11-
12-
### 🔧 Chore
13-
14-
- chore: update dependencies and GitHub Actions to latest versions (456df59)
15-
162

173
All notable changes to this project will be documented in this file.
4+
185
## [v2.3.1] - 2026-01-30
196

207
### 🔧 Chore
218

229
- chore: update dependencies and GitHub Actions to latest versions (456df59)
2310

24-
25-
2611
## [v2.3.0] - 2025-12-23
2712

2813
### ✨ Features

0 commit comments

Comments
 (0)