Skip to content

Commit 751e74e

Browse files
committed
changes in release yml
1 parent c60a874 commit 751e74e

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,39 @@ jobs:
2121
id: package-version
2222
uses: martinbeentjes/npm-get-version-action@v1.3.1
2323

24-
- name: Read CHANGELOG.md
24+
- name: Update CHANGELOG.md and get changes
2525
id: changelog
26-
uses: juliangruber/read-file-action@v1
27-
with:
28-
path: ./CHANGELOG.md
26+
run: |
27+
VERSION=${{ steps.package-version.outputs.current-version }}
28+
TODAY=$(date +%Y-%m-%d)
29+
30+
# Update the date in CHANGELOG.md
31+
sed -i "s/\[$VERSION\] - [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/[$VERSION] - $TODAY/" CHANGELOG.md
32+
33+
# Extract changes for this version
34+
CHANGES=$(sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$d')
35+
36+
echo "changes<<EOF" >> $GITHUB_OUTPUT
37+
echo "$CHANGES" >> $GITHUB_OUTPUT
38+
echo "EOF" >> $GITHUB_OUTPUT
39+
40+
- name: Commit CHANGELOG.md changes
41+
run: |
42+
git config --local user.email "action@github.com"
43+
git config --local user.name "GitHub Action"
44+
git add CHANGELOG.md
45+
git commit -m "Update CHANGELOG.md with today's date" || echo "No changes to commit"
46+
git push
2947
3048
- name: Create Release
3149
id: create_release
3250
uses: actions/create-release@v1
3351
env:
3452
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3553
with:
36-
tag_name: v${{ steps.package-version.outputs.current-version}}
54+
tag_name: v${{ steps.package-version.outputs.current-version }}
3755
release_name: Release ${{ steps.package-version.outputs.current-version }}
38-
body: ${{ steps.changelog.outputs.content }}
56+
body: ${{ steps.changelog.outputs.changes }}
3957
draft: false
4058
prerelease: false
4159

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ yarn-error.log*
3232
src/**/*.test.js
3333

3434
# Include any other patterns you want to ignore
35+
package-lock.json

0 commit comments

Comments
 (0)