Skip to content

Commit 914fc76

Browse files
committed
Fix automatic changelog generation to include current version's changes
The changelog generation as it was written would not include the latest "unreleased" changes since the git tag for the new release hadn't been created yet. This change fixes that issue by using the `--latest-version` flag of `auto-changelog`. The `--latest-version` flag replaces the "Unreleased" section with the given version, allowing us to generate a changelog before creating the git tag it references. Ex. `--latest-version 0.70.0` will create a `v0.70.0` entry in the changelog even though the latest tag is `v0.69.0`.
1 parent a2e4a2c commit 914fc76

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,21 @@ jobs:
3838
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3939
shell: bash
4040
run: |
41+
# Update version
42+
git config --global user.email "runner@gha.local"
43+
git config --global user.name "Github Action"
44+
cargo workspaces -v version -ay --force '*' --include-merged-tags --no-git-commit --exact patch
45+
export VERSION=$(cargo pkgid | sed -E 's/.*#(.*)/\1/g')
46+
4147
# Update changelog
4248
npm install auto-changelog@2.2.1
4349
auto-changelog --output RELEASES.md \
4450
--starting-version v0.11.0 \
51+
--latest-version "$VERSION" \
4552
--merge-pattern 'Auto merge of #(\d+) - .+\n\n(.+)' \
4653
--template releases-template.hbs
4754
48-
git config --global user.email "runner@gha.local"
49-
git config --global user.name "Github Action"
50-
cargo workspaces -v version -ay --force '*' --include-merged-tags --no-git-commit --exact patch
51-
export VERSION=$(cargo pkgid | sed -E 's/.*#(.*)/\1/g')
55+
# Commit and publish
5256
git commit -am "Release $VERSION"
5357
git tag "v$VERSION"
5458
cargo workspaces -v publish --from-git --skip-published

0 commit comments

Comments
 (0)