-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release please CHANGELOG automation #341
Release please CHANGELOG automation #341
Conversation
Signed-off-by: Roberto Giovanardi <[email protected]>
6da72c8
to
ed81ad5
Compare
} | ||
}, | ||
"release-type": "helm", | ||
"include-component-in-tag": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this setting we'll have tags named mender-5.10.2
instead of just 5.10.2
.
ed81ad5
to
2274cef
Compare
.gitlab-ci.yml
Outdated
# git cliff: override the changelog | ||
- test $GIT_CLIFF == "false" && echo "INFO - Skipping git-cliff" && exit 0 | ||
- git clone https://${GITHUB_USER}:${GITHUB_BOT_TOKEN_REPO_FULL}@github.com/${GITHUB_REPO_URL} | ||
- cd ${GITHUB_REPO_URL#*/} | ||
- RELEASE_PLEASE_PR=$(gh pr list --author "${GITHUB_USER_NAME}" --head "release-please--branches--${CI_COMMIT_REF_NAME}" --json number | jq -r '.[0].number // empty') | ||
- test -z "$RELEASE_PLEASE_PR" && echo "No release-please PR found" && exit 0 | ||
- echo "INFO - generating changelog notes from git cliff" | ||
&& gh pr checkout $RELEASE_PLEASE_PR | ||
&& git cliff --output mender/CHANGELOG.md --bump --github-repo ${GITHUB_REPO_URL} | ||
&& git add mender/CHANGELOG.md | ||
&& git commit --amend -s --no-edit | ||
&& git push origin --force | ||
# note: using sed to prevent release-please to mess up with the Github Release body | ||
- echo "INFO - updating PR body" | ||
&& git cliff --unreleased --bump -o tmp_pr_body.md --github-repo ${GITHUB_REPO_URL} | ||
&& sed -i 's/## mender-\([0-9.]*\)/## \1/' tmp_pr_body.md | ||
&& gh pr edit $RELEASE_PLEASE_PR --body-file tmp_pr_body.md | ||
&& rm tmp_pr_body.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every time I read this script I keep wondering what's the purpose of release-please. Isn't it simply a glorified gh pr create
/gh release create
?
If I'm not mistaken, this snippet is forcefully overwriting the entire content of the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the --unreleased
flag to just add the latest release, without overriding the previous ones.
Every time I read this script I keep wondering what's the purpose of release-please. Isn't it simply a glorified gh pr create/gh release create?
That, but most importantly it has the logic to check every commit and understand which will be the next version; the logic also applies to maintenance branches.
We could just rewrite this logic implementing a git cliff wrapper in bash/python, but this will end up in a custom tool, something that we'd like to avoid. The tool could be pretty simple, but would still require a fair amount of code and cases.
OTOH, we're still considering release-please experimental, so if the experience is these "testing" repositories is bad, we could simply try with another (internal?) tool.
With release-please and git cliff, the CHANGELOG.md and the releases are automated Ticket: MC-7582 Signed-off-by: Roberto Giovanardi <[email protected]>
2274cef
to
6d1eb5e
Compare
Added release-please and git cliff. After including a new
fix|feat|feat!
tomaster
, the tools are creating a new Changelog PR with the new version bumped accordingly to the commit messages.Notes
mender-5.10.2
instead of5.10.2
. This is configurable, but I'm doing this in preparation to the possiblemender-server
component