Skip to content

Commit c9082d8

Browse files
FIX (releases): Fix rewriting Contribute.md
1 parent e5666cc commit c9082d8

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,34 @@ jobs:
181181
# Save changelog to file
182182
echo -e "$CHANGELOG" > RELEASE_CHANGELOG.md
183183
184-
# Update main CHANGELOG.md
184+
# Update main CHANGELOG.md - preserve all version history
185185
if [ -f "CHANGELOG.md" ]; then
186-
# Create new changelog content
187-
echo -e "$CHANGELOG" > NEW_CHANGELOG.md
188-
# Get existing changelog content after the [Unreleased] section
189-
sed -n '/## \[Unreleased\]/,$p' CHANGELOG.md | tail -n +3 >> NEW_CHANGELOG.md
186+
# Get the header until [Unreleased] section
187+
sed -n '1,/## \[Unreleased\]/p' CHANGELOG.md > NEW_CHANGELOG.md
188+
echo "" >> NEW_CHANGELOG.md
189+
# Add the new release (without the "# Changelog" header)
190+
echo "## [${NEW_VERSION}] - $(date +%Y-%m-%d)" >> NEW_CHANGELOG.md
191+
echo "" >> NEW_CHANGELOG.md
192+
193+
# Add the new release sections
194+
if [ -n "$FEATURES" ]; then
195+
echo "### ✨ Features" >> NEW_CHANGELOG.md
196+
echo -e "$FEATURES" >> NEW_CHANGELOG.md
197+
fi
198+
199+
if [ -n "$FIXES" ]; then
200+
echo "### 🐛 Bug Fixes" >> NEW_CHANGELOG.md
201+
echo -e "$FIXES" >> NEW_CHANGELOG.md
202+
fi
203+
204+
if [ -n "$REFACTORS" ]; then
205+
echo "### 🔨 Refactoring" >> NEW_CHANGELOG.md
206+
echo -e "$REFACTORS" >> NEW_CHANGELOG.md
207+
fi
208+
209+
# Get existing releases (everything after first ## [version] pattern)
210+
sed -n '/## \[[0-9]/,$p' CHANGELOG.md >> NEW_CHANGELOG.md
211+
190212
# Replace the original file
191213
mv NEW_CHANGELOG.md CHANGELOG.md
192214
else
@@ -211,16 +233,3 @@ jobs:
211233
body: ${{ steps.changelog.outputs.changelog }}
212234
draft: false
213235
prerelease: false
214-
215-
- name: Update version files and changelog
216-
if: steps.version_bump.outputs.should_release == 'true'
217-
run: |
218-
NEW_VERSION="${{ steps.version_bump.outputs.new_version }}"
219-
cd frontend
220-
npm version $NEW_VERSION --no-git-tag-version
221-
cd ..
222-
git config user.name "github-actions[bot]"
223-
git config user.email "github-actions[bot]@users.noreply.github.com"
224-
git add frontend/package.json frontend/package-lock.json CHANGELOG.md
225-
git commit -m "chore: bump version to ${NEW_VERSION} [skip-release]" || true
226-
git push origin main || true

0 commit comments

Comments
 (0)