-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With release-please and git cliff, the CHANGELOG.md and the releases are automated Ticket: MC-7582 Signed-off-by: Roberto Giovanardi <[email protected]>
- Loading branch information
Showing
4 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ mender-*.tgz | |
/values*.yaml | ||
/index.yaml | ||
tests/hm-values.yaml | ||
cliff.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,10 +34,40 @@ variables: | |
options: | ||
- "true" | ||
- "false" | ||
GITHUB_REPO_URL: | ||
description: "The Github Repo URL for release-please, in the format of 'owner/repo'" | ||
value: "mendersoftware/mender-helm" | ||
DEFAULT_BRANCH: "master" | ||
GITHUB_REPO_URL: | ||
description: "The Github Repo URL for release-please, in the format of 'owner/repo'" | ||
value: "mendersoftware/mender-helm" | ||
GITHUB_USER: | ||
description: "The Github user for release-please" | ||
value: "mender-test-bot" | ||
GITHUB_USER_NAME: | ||
description: "The Github username for release-please" | ||
value: "mender-test-bot" | ||
GITHUB_USER_EMAIL: | ||
description: "The Github user email for release-please" | ||
value: "[email protected]" | ||
RUN_RELEASE: | ||
description: "Run a new release" | ||
value: "false" | ||
options: | ||
- "true" | ||
- "false" | ||
GIT_CLIFF: | ||
description: "Run git cliff to override the release-please changelog" | ||
value: "true" | ||
options: | ||
- "true" | ||
- "false" | ||
|
||
stages: | ||
- build | ||
- test | ||
- changelog | ||
- release | ||
- publish | ||
- version-bump | ||
|
||
|
@@ -790,3 +820,77 @@ cleanup_eks_cluster:success: | |
cleanup_eks_cluster:failed:manual: | ||
when: manual | ||
<<: *eks_cleanup | ||
|
||
changelog: | ||
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:20 | ||
stage: changelog | ||
tags: | ||
- hetzner-amd-beefy | ||
rules: | ||
- if: $CI_PIPELINE_SOURCE == "pipeline" | ||
when: never | ||
- if: $RUN_RELEASE == "true" | ||
when: never | ||
- if: $CI_COMMIT_BRANCH =~ "/^\d+\.\d+\.x$/" | ||
- if: $CI_COMMIT_BRANCH == $DEFAULT_BRANCH | ||
before_script: | ||
# install release-please | ||
- npm install -g release-please | ||
# install github-cli | ||
- | | ||
mkdir -p -m 755 /etc/apt/keyrings \ | ||
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ | ||
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ | ||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ | ||
&& apt update \ | ||
&& apt install gh jq -y | ||
# Setting up git | ||
- | | ||
echo "INFO - setting up git" | ||
git config --global user.email "${GITHUB_USER_EMAIL}" | ||
git config --global user.name "${GITHUB_USER_NAME}" | ||
- npm install -g git-cliff | ||
# GITHUB_TOKEN for Github cli authentication | ||
- export GITHUB_TOKEN=${GITHUB_CLI_TOKEN} | ||
# getting the centralized git cliff config | ||
- wget --output-document cliff.toml https://raw.githubusercontent.com/mendersoftware/mendertesting/master/utils/cliff.toml | ||
script: | ||
- release-please release-pr | ||
--token=${GITHUB_BOT_TOKEN_REPO_FULL} | ||
--repo-url=${GITHUB_REPO_URL} | ||
--target-branch=${CI_COMMIT_REF_NAME} | ||
# 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 | ||
|
||
release:github: | ||
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:20 | ||
stage: release | ||
tags: | ||
- hetzner-amd-beefy | ||
rules: | ||
- if: $CI_PIPELINE_SOURCE == "pipeline" | ||
when: never | ||
- if: $CI_COMMIT_BRANCH =~ "/^\d+\.\d+\.x$/" && $RUN_RELEASE == "true" | ||
- if: $CI_COMMIT_BRANCH == $DEFAULT_BRANCH && $RUN_RELEASE == "true" | ||
script: | ||
- npm install -g release-please | ||
- release-please github-release | ||
--token=${GITHUB_BOT_TOKEN_REPO_FULL} | ||
--repo-url=${GITHUB_REPO_URL} | ||
--target-branch=${CI_COMMIT_REF_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"mender": "5.10.1" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"packages": { | ||
"mender": { | ||
"changelog-path": "CHANGELOG.md", | ||
"bump-minor-pre-major": false, | ||
"bump-patch-for-minor-pre-major": false, | ||
"draft": false, | ||
"prerelease": false | ||
} | ||
}, | ||
"release-type": "helm", | ||
"include-component-in-tag": true, | ||
"include-v-in-tag": false, | ||
"bootstrap-sha": "bced4eecaebc707975b011d64bc28354367433c0", | ||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" | ||
} | ||
|