Skip to content

Commit 6966d8c

Browse files
fix(ci): release changelog generation
This commit fixes the changelog generation by overriding tag pattern depending on whether we're in a pre-release or not. In the past, pre-release changelogs included too many changes and the release changes included *not enough*.
1 parent 29daec3 commit 6966d8c

3 files changed

Lines changed: 27 additions & 22 deletions

File tree

.github/workflows/create-release-pr.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,21 @@ jobs:
9797
run: |
9898
export IS_PRERELEASE=$(node scripts/semver-is-prerelease.mjs ${{ steps.project-meta.outputs.next-version }});
9999
100-
export START_ARG="--latest";
100+
export OPT_TAG="--tag=${{ steps.project-meta.outputs.next-version }}";
101+
102+
export OPT_TAG_PATTERN="--tag-pattern='^[0-9]+.[0-9]+.[0-9]+$'";
103+
export OPT_START="--unreleased";
101104
if [ "true" == "$IS_PRERELEASE" ]; then
102-
export START_ARG="--unreleased";
105+
export OPT_START="--latest";
106+
export OPT_TAG_PATTERN="--tag-pattern='^[0-9]+.[0-9]+.[0-9]+(-beta|-rc|-alpha)?'";
103107
fi
104108
105109
git cliff \
106110
--repository=${{ github.workspace }}/.git \
107111
--config=./cliff.toml \
108-
$START_ARG \
109-
--tag=${{ steps.project-meta.outputs.next-version }} \
112+
$OPT_START \
113+
$OPT_TAG \
114+
$OPT_TAG_PATTERN \
110115
--prepend=CHANGELOG.md
111116
112117
# Create release PR

.github/workflows/release.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,26 @@ jobs:
250250
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT || secrets.GITHUB_TOKEN }}
251251
GITHUB_REPO: ${{ github.repository }}
252252
run: |
253+
export OPT_START="--unreleased";
254+
export OPT_TAG="";
253255
if [ "tag" == "${{ github.ref_type }}" ]; then
254-
git cliff --repository=${{ github.workspace }}/.git --latest > CHANGELOG.current;
255-
else
256-
git cliff \
257-
--repository=${{ github.workspace }}/.git \
258-
--unreleased \
259-
--tag=${{ needs.meta.outputs.next-release-tag }} \
260-
> CHANGELOG.current;
256+
export OPT_START="--latest";
257+
export OPT_TAG="--tag=${{ needs.meta.outputs.next-release-tag }}";
261258
fi
262259
260+
export OPT_TAG_PATTERN="--tag-pattern='^[0-9]+.[0-9]+.[0-9]+$'";
261+
if [ "true" == "${{ needs.meta.outputs.is-prerelease }}" ]; then
262+
export OPT_TAG_PATTERN="--tag-pattern='^[0-9]+.[0-9]+.[0-9]+(-beta|-rc|-alpha)?'";
263+
fi
264+
265+
git cliff \
266+
--repository=${{ github.workspace }}/.git \
267+
--config=./cliff.toml \
268+
$OPT_START \
269+
$OPT_TAG \
270+
$OPT_TAG_PATTERN \
271+
> CHANGELOG.current;
272+
263273
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
264274
with:
265275
path: artifacts

cliff.toml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,4 @@ topo_order = false
7474
sort_commits = "newest"
7575

7676
# glob pattern for matching git tags
77-
tag_pattern = "^[0-9]+.[0-9]+.[0-9]+(-beta|-rc|-alpha)?"
78-
79-
# regex for skipping tags
80-
#
81-
# NOTE: we don't skip taks for beta/rc/alpha since we want their features
82-
# to be included in the next stable release
83-
#
84-
#skip_tags = "beta|rc|alpha"
85-
86-
# tags to ignore
87-
ignore_tags = "beta|rc|alpha"
77+
tag_pattern = "^[0-9]+.[0-9]+.[0-9]+$"

0 commit comments

Comments
 (0)