Skip to content

Commit e7f4f15

Browse files
authored
chore(boil): Add release script and changelog (#1303)
* chore(boil): Add release script This script is only partially tested as some commands can only be run on a clean work directory. The first release PR created by this script will include potentially required fixes. * chore(boil): Add changelog This changelog is generated by git-cliff based on conventional commits. * chore(boil): Add dependency checks to release script * chore(boil): Update changelog template
1 parent 0065159 commit e7f4f15

File tree

6 files changed

+221
-2
lines changed

6 files changed

+221
-2
lines changed

.scripts/release_boil.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
MESSAGE="# Managed by .scripts\/release_boil.sh"
5+
6+
BUMPED_VERSION=$(git-cliff --config rust/boil/cliff.toml --bumped-version)
7+
CLEANED_BUMPED_VERSION=${BUMPED_VERSION#boil-}
8+
9+
RELEASE_BRANCH="chore/boil-release-$CLEANED_BUMPED_VERSION"
10+
11+
echo "Checking if working directory is clean"
12+
if ! git diff-index --quiet HEAD --; then
13+
echo "Working directory is dirty, aborting" >&2
14+
exit 1
15+
fi
16+
17+
# Prompt the user to confirm their Git identity used to create the commit
18+
GIT_EMAIL=$(git config --includes --get user.email)
19+
GIT_USER=$(git config --includes --get user.name)
20+
21+
echo "The following Git user will be used: $GIT_USER <$GIT_EMAIL>"
22+
echo "Is this correct (Y/n)?"
23+
read -r RESPONSE
24+
25+
if [[ "$RESPONSE" == "y" || "$RESPONSE" == "Y" || -z "$RESPONSE" ]]; then
26+
echo "Proceeding with $GIT_USER <$GIT_EMAIL>"
27+
else
28+
>&2 echo "User not accepted. Exiting."
29+
exit 1
30+
fi
31+
32+
# Check dependencies
33+
gh auth status
34+
git-cliff --version
35+
36+
# Switch to main branch after we validated that the working directory is clean
37+
git switch main
38+
39+
# Make sure we have the latest remote changes locally
40+
git pull
41+
42+
echo "Creating and switching to $RELEASE_BRANCH branch"
43+
git switch -c "$RELEASE_BRANCH"
44+
45+
echo "Generating updated changelog for $BUMPED_VERSION"
46+
git-cliff --config rust/boil/cliff.toml --tag "$BUMPED_VERSION" > rust/boil/CHANGELOG.md
47+
48+
echo "Updating the version to $CLEANED_BUMPED_VERSION in the Cargo.toml file"
49+
sed -E -i "s/^version = .* $MESSAGE$/version = \"$CLEANED_BUMPED_VERSION\" $MESSAGE/" rust/boil/Cargo.toml
50+
51+
echo "Committing changes"
52+
# Make sure that there are changes to be committed
53+
if git diff-index --quiet HEAD --; then
54+
echo "No changes to commit"
55+
exit 1
56+
fi
57+
58+
git add rust/boil/CHANGELOG.md rust/boil/Cargo.toml
59+
git commit --message "chore(boil): Release $CLEANED_BUMPED_VERSION" --no-verify --gpg-sign
60+
61+
echo "Pushing changes and raising PR"
62+
CHANGELOG_SUMMARY=$(git-cliff --config rust/boil/cliff.toml --tag "$BUMPED_VERSION" --strip header --unreleased)
63+
PR_BODY="This PR was raised automatically by a release script. It releases $BUMPED_VERSION:\n\n$CHANGELOG_SUMMARY)"
64+
65+
git push --set-upstream origin "$RELEASE_BRANCH"
66+
gh pr create --base main \
67+
--title "chore(boil): Release $CLEANED_BUMPED_VERSION" \
68+
--body "$PR_BODY" \
69+
--assignee "@me" \
70+
--draft
71+
72+
echo "After merging the PR, make sure to run the following commands to finish up the release:"
73+
echo "git switch main && git pull"
74+
echo "git tag -s $BUMPED_VERSION" -m "$BUMPED_VERSION"
75+
echo "git push --follow-tags"

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/boil/CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!-- GENERATED BY GIT-CLIFF, DO NOT EDIT MANUALLY -->
2+
3+
# Changelog
4+
5+
All notable changes to this project will be documented in this file.
6+
7+
## [Unreleased]
8+
9+
### Features
10+
11+
- Support Containerfiles per version ([#1302](https://github.com/stackabletech/docker-images/pull/1302)).
12+
13+
## [0.1.4] - 2025-09-30
14+
15+
[See complete diff](https://github.com/stackabletech/docker-images/compare/boil-0.1.3..boil-0.1.4)
16+
17+
### Bug Fixes
18+
19+
- Revert accidental default registry change from #1281 ([#1288](https://github.com/stackabletech/docker-images/pull/1288)).
20+
21+
## [0.1.3] - 2025-09-29
22+
23+
[See complete diff](https://github.com/stackabletech/docker-images/compare/boil-0.1.2..boil-0.1.3)
24+
25+
### Features
26+
27+
- Add support for port in registry host ([#1281](https://github.com/stackabletech/docker-images/pull/1281)).
28+
29+
## [0.1.2] - 2025-09-18
30+
31+
[See complete diff](https://github.com/stackabletech/docker-images/compare/boil-0.1.1..boil-0.1.2)
32+
33+
### Features
34+
35+
- Add support for Nushell completions ([#1259](https://github.com/stackabletech/docker-images/pull/1259)).
36+
37+
## [0.1.1] - 2025-09-16
38+
39+
### Bug Fixes
40+
41+
- Return error if docker child process fails ([#1252](https://github.com/stackabletech/docker-images/pull/1252)).
42+
43+
<!-- GENERATED BY GIT-CLIFF, DO NOT EDIT MANUALLY -->

rust/boil/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "boil"
3-
version = "0.1.0"
3+
version = "0.1.4" # Managed by .scripts/release_boil.sh
44
edition = "2024"
55
authors.workspace = true
66
license.workspace = true

rust/boil/RELEASE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Release Process
2+
3+
To release a new version of `boil` the following steps need to be done:
4+
5+
1. Make sure the local `main` branch is up-to-date and in a clean state.
6+
2. Run the `.scripts/release_boil.sh` script. This takes care of
7+
- generating the changelog
8+
- updating the `Cargo.toml` version
9+
- raising a PR with the changes
10+
3. Merge the PR.
11+
4. Add the appropriate tag on `main` by running `git tag -s`.
12+
5. Push the tag.

rust/boil/cliff.toml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
[bump]
2+
# We set this to false, because we currently use a 0.X.X version. Features will thus only bump the
3+
# patch-level version.
4+
features_always_bump_minor = false
5+
6+
# We set this to false, because we currently use a 0.X.X version. Breaking changes will thus only
7+
# bump the minor version.
8+
breaking_always_bump_major = false
9+
10+
initial_tag = "0.1.0"
11+
12+
[git]
13+
# All commits should be parsed as conventional commits.
14+
conventional_commits = true
15+
16+
# All unconventional commits are filtered out and ignored.
17+
filter_unconventional = true
18+
19+
# Commits listed in the changelog are sorted from newest to oldest.
20+
sort_commits = "newest"
21+
22+
# Filter and ignore all commits NOT matched by the commit parsers below.
23+
filter_commits = true
24+
25+
commit_parsers = [
26+
{ message = "^feat\\(boil\\)", group = "<!-- 0 --> Features" },
27+
{ message = "^fix\\(boil\\)", group = "<!-- 1 --> Bug Fixes" },
28+
{ message = "^docs?\\(boil\\)", group = "<!-- 2 --> Documentation" },
29+
{ message = "^(perf|refactor|test)\\(boil\\)", group = "<!-- 3 --> Improvements" },
30+
{ message = "^chore\\(boil\\): Improve", group = "<!-- 3 --> Improvements" },
31+
{ message = "^chore\\(boil\\)", group = "<!-- 4 --> Miscellaneous" },
32+
{ message = "^chore\\(boil\\): Release", skip = true },
33+
]
34+
35+
commit_preprocessors = [
36+
# Replace issue numbers with link templates to be updated in `changelog.postprocessors`.
37+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/pull/${2}))" },
38+
]
39+
40+
# Only consider the 'boil-' Git tags when generating the changelog
41+
tag_pattern = "boil-[0-9]*.[0-9]*.[0-9]*"
42+
43+
# Ignore the first release tag
44+
skip_tags = "boil-0.1.0"
45+
46+
[changelog]
47+
trim = true
48+
49+
postprocessors = [
50+
# Replace the placeholder `<REPO>` with a URL.
51+
{ pattern = '<REPO>', replace = "https://github.com/stackabletech/docker-images" },
52+
]
53+
54+
header = """<!-- GENERATED BY GIT-CLIFF, DO NOT EDIT MANUALLY -->
55+
56+
# Changelog
57+
58+
All notable changes to this project will be documented in this file.
59+
"""
60+
61+
body = """
62+
63+
{% if version %}\
64+
{% if previous.version %}\
65+
## [{{ version | trim_start_matches(pat="boil-") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
66+
67+
[See complete diff](<REPO>/compare/{{ previous.version }}..{{ version }})
68+
{% else %}\
69+
## [{{ version | trim_start_matches(pat="boil-") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
70+
{% endif %}\
71+
{% else %}\
72+
## [Unreleased]
73+
{% endif %}\
74+
75+
{% for group, commits in commits | group_by(attribute="group") %}
76+
### {{ group | striptags | trim | upper_first }}
77+
{% for commit in commits %}
78+
- {% if commit.breaking %}**BREAKING:** {% endif %}\
79+
{{ commit.message | upper_first }}.\
80+
{%- endfor %}
81+
{% endfor -%}
82+
83+
84+
"""
85+
86+
footer = """
87+
88+
<!-- GENERATED BY GIT-CLIFF, DO NOT EDIT MANUALLY -->
89+
"""

0 commit comments

Comments
 (0)