Skip to content

Commit 2f3c4df

Browse files
fix(ci): release changelog generation (#263)
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 ce667dc commit 2f3c4df

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,19 @@ 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]+$';
101103
if [ "true" == "$IS_PRERELEASE" ]; then
102-
export START_ARG="--unreleased";
104+
export OPT_TAG_PATTERN=--tag-pattern='^[0-9]+.[0-9]+.[0-9]+(-beta|-rc|-alpha)?';
103105
fi
104106
105107
git cliff \
106108
--repository=${{ github.workspace }}/.git \
107109
--config=./cliff.toml \
108-
$START_ARG \
109-
--tag=${{ steps.project-meta.outputs.next-version }} \
110+
--unreleased \
111+
$OPT_TAG \
112+
$OPT_TAG_PATTERN \
110113
--prepend=CHANGELOG.md
111114
112115
# 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=--current;
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)