Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
d99806b
feat(release): Add workflows for automated release process and versio…
milinddethe15 Jan 28, 2026
2a8e0aa
feat(release): Implement automated release process with changelog gen…
milinddethe15 Feb 5, 2026
67d3683
fix lint
milinddethe15 Feb 5, 2026
0c82410
enhance tag validation and branch creation
milinddethe15 Feb 9, 2026
1104a83
fix: Add 'area/release' to ignored labels in PR title check
milinddethe15 Feb 9, 2026
e9addbb
feat(release): Enhance release workflows with manual trigger and imag…
milinddethe15 Feb 9, 2026
1d3cea1
feat(release): Add PyPI API token for publishing packages
milinddethe15 Feb 9, 2026
51667aa
feat(release): Update concurrency settings in publish-helm-charts wor…
milinddethe15 Feb 22, 2026
422bdfa
feat(release): Update git-cliff-action args to include --unreleased o…
milinddethe15 Feb 22, 2026
a195905
refactor: reorganize release workflow to generate changelog before Gi…
milinddethe15 Feb 22, 2026
90a0ce8
feat(release): Update GitHub release action to remove changelog prepe…
milinddethe15 Feb 22, 2026
0304dfe
feat(release): Refactor GitHub release job to integrate changelog gen…
milinddethe15 Feb 22, 2026
10b5d64
feat(release): create_branch_and_tag job to create_branch and streaml…
milinddethe15 Feb 22, 2026
1d39734
feat(release): update release documentation and remove changelog gene…
milinddethe15 Feb 22, 2026
f6aa7d3
fix: update release branch naming to use major.minor version format
milinddethe15 Feb 22, 2026
1ce178d
fix endline
milinddethe15 Feb 22, 2026
c98aad3
feat(release): update README with upstream tag fetching instructions
milinddethe15 Feb 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(release): Implement automated release process with changelog gen…
…eration

Signed-off-by: milinddethe15 <milinddethe15@gmail.com>
  • Loading branch information
milinddethe15 committed Feb 22, 2026
commit 2a8e0aa14622096123850e7a531c156b76085361
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,18 @@ helm-lint: ## Run Helm chart lint test.
.PHONY: helm-docs
helm-docs: helm-docs-plugin ## Generates markdown documentation for helm charts from requirements and values files.
$(HELM_DOCS) --sort-values-order=file

##@ Release

# Release version (X.Y.Z or X.Y.Z-rc.N)
VERSION ?=
GITHUB_TOKEN ?=

.PHONY: release
release: ## Create a new release.
@if [ -z "$(VERSION)" ]; then \
echo "ERROR: VERSION is required. Usage: make release VERSION=X.Y.Z GITHUB_TOKEN=<token>"; \
exit 1; \
fi
@export GITHUB_TOKEN=$(GITHUB_TOKEN); \
./hack/release.sh $(VERSION)
27 changes: 20 additions & 7 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@ owner = "kubeflow"
repo = "trainer"

[changelog]
header = """
# Changelog
"""

body = """
{%- if version %}
## [{{ version }}](https://github.com/kubeflow/trainer/releases/tag/{{ version }}) ({{ timestamp | date(format="%Y-%m-%d") }})

This is Kubeflow Trainer {{ version }} release.

```bash
kubectl apply --server-side -k "https://github.com/kubeflow/trainer.git/manifests/overlays/manager?ref={{ version }}"
kubectl apply --server-side -k "https://github.com/kubeflow/trainer.git/manifests/overlays/runtimes?ref={{ version }}"
```

You can now install controller manager with Helm charts 🚀

```bash
helm install kubeflow-trainer oci://ghcr.io/kubeflow/charts/kubeflow-trainer --version {{ version | trim_start_matches(pat="v") }}
```

For more information, please see [the Kubeflow Trainer docs](https://www.kubeflow.org/docs/components/trainer/overview/)

{%- else %}
## [Unreleased]
{%- endif %}
Expand All @@ -24,12 +36,13 @@ body = """
{% for commit in group_commits | reverse -%}
{%- set message = commit.message | split(pat="\n") | first | trim -%}
{%- set parts = message | split(pat=" (#") -%}
{%- set author = commit.remote.username | default(value=commit.author.name) -%}
{% if parts | length > 1 and parts | last | trim | split(pat=")") | length > 1 -%}
{%- set pr_part = parts | last | trim -%}
{%- set pr_number = pr_part | replace(from=")", to="") -%}
- {{ parts | slice(end=-1) | join(sep=" (#") }} ([#{{ pr_number }}](https://github.com/kubeflow/trainer/pull/{{ pr_number }}) by @{{ commit.remote.username }})
- {{ parts | slice(end=-1) | join(sep=" (#") }} ([#{{ pr_number }}](https://github.com/kubeflow/trainer/pull/{{ pr_number }}) by @{{ author }})
{% else -%}
- {{ message }} (@{{ commit.remote.username }})
- {{ message }} (@{{ author }})
{% endif -%}
{% endfor %}

Expand Down Expand Up @@ -71,4 +84,4 @@ commit_parsers = [
{ message = "^chore(\\(.*\\))?:", group = "⚙️ Miscellaneous Tasks" },
{ message = "^revert(\\(.*\\))?:", group = "⏪ Reverts" },
{ message = ".*", skip = true },
]
]
60 changes: 45 additions & 15 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,40 @@ MANIFESTS_DIR="$REPO_ROOT/manifests"
CHART_DIR="$REPO_ROOT/charts/kubeflow-trainer"
CHART_FILE="$CHART_DIR/Chart.yaml"
PYTHON_API_VERSION_FILE="$REPO_ROOT/api/python_api/kubeflow_trainer_api/__init__.py"
RELEASE_BRANCH="release-$NEW_VERSION"


# Identify branch and ensure it's up to date if it tracks a remote
# Ensure we're on master branch
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null || true)
if [ "$CURRENT_BRANCH" != "master" ]; then
echo "Current branch is ${CURRENT_BRANCH}, switching to master..."
git checkout master
fi

# Fetch refs and verify tag absence
# Fetch refs and sync with origin/master
echo "Fetching latest changes from origin..."
git fetch --tags
git fetch origin master
if [ -n "$UPSTREAM" ]; then
git pull --ff-only

# Ensure master is up to date with origin/master
if ! git merge-base --is-ancestor HEAD origin/master; then
echo "Local master is ahead of origin/master. Please push or resolve conflicts first."
exit 1
fi

echo "Syncing master with origin/master..."
git reset --hard origin/master

# Verify tag doesn't already exist
if git tag --list | grep -q "^${TAG}$"; then
echo "Tag: ${TAG} already exists. Release can't be published."
exit 1
fi

# Ensure current branch contains origin/master
if ! git merge-base --is-ancestor origin/master HEAD; then
echo "Current branch ${CURRENT_BRANCH} is not up to date with origin/master. Please rebase or merge origin/master first."
exit 1
fi
# Create new release branch
echo "Creating new branch: ${RELEASE_BRANCH}"
git checkout -b "$RELEASE_BRANCH"

echo -e "\nCreating a new release commit on branch ${CURRENT_BRANCH}. Tag to be created: ${TAG}\n"
echo -e "\nCreating a new release commit on branch ${RELEASE_BRANCH}. Tag to be created: ${TAG}\n"

echo -n "v$NEW_VERSION" > "$VERSION_FILE"
echo "Updated VERSION file to $NEW_VERSION"
Expand Down Expand Up @@ -108,13 +118,33 @@ chart_path.write_text(pattern.sub(f"version: {new_version}", data, count=1))
PYTHON
echo "Updated Helm chart version to $NEW_VERSION"

CHANGELOG_PATH="$REPO_ROOT/CHANGELOG.md"
echo "Generating changelog for $TAG"
ABSOLUTE_REPO_ROOT="$(cd "$REPO_ROOT" && pwd)"
if [ -z "${GITHUB_TOKEN:-}" ]; then
echo "WARNING: GITHUB_TOKEN not set. Set it to avoid GitHub API rate limits."
echo "Export GITHUB_TOKEN before running this script: export GITHUB_TOKEN=your_token"
fi

# Generate and prepend new changelog section
TEMP_FILE=$(mktemp)
docker run --rm -u "$(id -u):$(id -g)" -v "$ABSOLUTE_REPO_ROOT:/app" \
-e "GITHUB_TOKEN=$GITHUB_TOKEN" -w /app \
"ghcr.io/orhun/git-cliff/git-cliff:latest" --unreleased --tag "$TAG" -o - > "$TEMP_FILE"

if [ -f "$CHANGELOG_PATH" ]; then
sed -i "1 r $TEMP_FILE" "$CHANGELOG_PATH"
else
{ echo "# Changelog"; cat "$TEMP_FILE"; } > "$CHANGELOG_PATH"
fi
rm "$TEMP_FILE"
echo "Changelog generated at $CHANGELOG_PATH"

echo "Running make generate"
make -C "$REPO_ROOT" generate
echo "Completed make generate"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sed -i "s/__version__ = \".*\"/__version__ = \"$NEW_VERSION\"/" "$PYTHON_API_VERSION_FILE"
echo "Updated Python API version to $NEW_VERSION"

$PYTHON_API_VERSION_FILE is git-added but never modified by the script. The init.py version won't be updated, and check-release.yaml will fail on the mismatch. Add before git add:

git add "$VERSION_FILE" "$MANIFESTS_DIR" "$CHART_DIR" "$PYTHON_API_VERSION_FILE"
git add "$VERSION_FILE" "$MANIFESTS_DIR" "$CHART_DIR" "$PYTHON_API_VERSION_FILE" "$CHANGELOG_PATH"
git commit -s -m "Release $TAG"

echo -e "\nRelease $NEW_VERSION is ready. Commit created locally on branch ${CURRENT_BRANCH}."
echo "Open a PR with this commit; pushing is intentionally not done by the script."
echo -e "\nRelease $NEW_VERSION is ready. Commit created on branch ${RELEASE_BRANCH}."