feat: add MR description with release changes

This commit is contained in:
2024-10-05 11:50:29 +02:00
parent c4b4b66692
commit 4112728e1e
+7 -2
View File
@@ -27,11 +27,13 @@ changelog:
GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
script:
- 'echo "Generating changelog"'
- 'git-cliff --bump --unreleased > CHANGES.md'
- 'git-cliff --bump > CHANGELOG.md'
- 'echo "Bumping version"'
- 'git-cliff --bumped-version 2>/dev/null > VERSION'
artifacts:
paths:
- CHANGES.md
- CHANGELOG.md
- VERSION
rules:
@@ -60,6 +62,7 @@ handle_mr:
MR=$(echo "${MRS}" | jq ".[].iid")
BRANCH=$(echo "${BRANCHES}" | jq ".[].name")
TITLE="chore(release): prepare for $(cat VERSION)"
DESCRIPTION="$(cat CHANGES.md)"
CONTENT="$(base64 -w0 <CHANGELOG.md)"
BODY_TMPL='{"branch": "next-release", "start_branch": $startBranch, "author_name": "Unbound Release", "content": $content, "commit_message": $title, "encoding": "base64" }'
if [ -n "${BRANCH}" ]; then
@@ -96,9 +99,10 @@ handle_mr:
-H "Content-Type: application/json" \
"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/merge_requests/${MR}/rebase"
echo "Updating title"
BODY_TMPL='{"target_branch":$target,"title":$title,"remove_source_branch":true,"squash":true}'
BODY_TMPL='{"target_branch":$target,"title":$title,"description":$description,"remove_source_branch":true,"squash":true}'
BODY=$(jq --null-input -c \
--arg title "${TITLE}" \
--arg description "${DESCRIPTION}" \
--arg target "${CI_DEFAULT_BRANCH}" \
"${BODY_TMPL}")
curl -sf -X PUT \
@@ -108,9 +112,10 @@ handle_mr:
"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/merge_requests/${MR}"
else
echo "Creating new MR"
BODY_TMPL='{"source_branch":"next-release","target_branch":$target,"title":$title,"remove_source_branch":true,"squash":true}'
BODY_TMPL='{"source_branch":"next-release","target_branch":$target,"title":$title,"description":$description,"remove_source_branch":true,"squash":true}'
BODY=$(jq --null-input -c \
--arg title "${TITLE}" \
--arg description "${DESCRIPTION}" \
--arg target "${CI_DEFAULT_BRANCH}" \
"${BODY_TMPL}")
curl -sf -X POST \