Skip to content

Commit fe7f433

Browse files
committed
chore(ci): update release and changelog workflows
- Add changelog generation via requarks/changelog-action - Switch update-changelog to workflow_dispatch trigger - Add fetch-depth: 0 for full git history
1 parent a737b1e commit fe7f433

2 files changed

Lines changed: 50 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v6
25+
with:
26+
ref: main
27+
fetch-depth: 0
2528

2629
- name: Determine version
2730
id: version
@@ -45,9 +48,33 @@ jobs:
4548
git tag "${{ steps.version.outputs.tag }}"
4649
git push origin "${{ steps.version.outputs.tag }}"
4750
51+
- name: Get previous tag
52+
id: previous
53+
run: |
54+
PREVIOUS=$(git tag --sort=-v:refname | grep -E '^[0-9]{4}\.' | grep -v "^${{ steps.version.outputs.tag }}$" | head -1)
55+
echo "tag=$PREVIOUS" >> "$GITHUB_OUTPUT"
56+
57+
- name: Generate changelog
58+
id: changelog
59+
uses: requarks/changelog-action@v1
60+
with:
61+
token: ${{ github.token }}
62+
fromTag: ${{ steps.version.outputs.tag }}
63+
toTag: ${{ steps.previous.outputs.tag }}
64+
excludeTypes: build,docs,other,style,ci,chore
65+
useGitmojis: false
66+
writeToFile: true
67+
4868
- name: Create GitHub release
4969
uses: softprops/action-gh-release@v2
5070
with:
5171
tag_name: ${{ steps.version.outputs.tag }}
5272
name: ${{ steps.version.outputs.tag }}
53-
generate_release_notes: true
73+
body: ${{ steps.changelog.outputs.changes }}
74+
75+
- name: Commit updated CHANGELOG
76+
uses: stefanzweifel/git-auto-commit-action@v7
77+
with:
78+
branch: main
79+
commit_message: "docs: update CHANGELOG for ${{ steps.version.outputs.tag }}"
80+
file_pattern: CHANGELOG.md
Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name: Update Changelog
22

33
on:
4-
release:
5-
types: [released]
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version to regenerate changelog for'
8+
required: true
9+
type: string
610

711
permissions:
812
contents: read
@@ -17,16 +21,27 @@ jobs:
1721
uses: actions/checkout@v6
1822
with:
1923
ref: main
24+
fetch-depth: 0
2025

21-
- name: Update Changelog
22-
uses: stefanzweifel/changelog-updater-action@v1
26+
- name: Get previous tag
27+
id: previous
28+
run: |
29+
PREVIOUS=$(git tag --sort=-v:refname | grep -E '^[0-9]{4}\.' | grep -v "^${{ github.event.inputs.version }}$" | head -1)
30+
echo "tag=$PREVIOUS" >> "$GITHUB_OUTPUT"
31+
32+
- name: Generate changelog
33+
uses: requarks/changelog-action@v1
2334
with:
24-
latest-version: ${{ github.event.release.name }}
25-
release-notes: ${{ github.event.release.body }}
35+
token: ${{ github.token }}
36+
fromTag: ${{ github.event.inputs.version }}
37+
toTag: ${{ steps.previous.outputs.tag }}
38+
excludeTypes: build,docs,other,style,ci,chore
39+
useGitmojis: false
40+
writeToFile: true
2641

2742
- name: Commit updated CHANGELOG
2843
uses: stefanzweifel/git-auto-commit-action@v4
2944
with:
3045
branch: main
31-
commit_message: "docs: update CHANGELOG for ${{ github.event.release.name }}"
46+
commit_message: "docs: update CHANGELOG for ${{ github.event.inputs.version }}"
3247
file_pattern: CHANGELOG.md

0 commit comments

Comments
 (0)