Skip to content

Commit e624f48

Browse files
Merge pull request #20 from Krishna-kg732/test-release
chore(release): Release v99.0.0
2 parents 6bbc7c0 + 1dc464c commit e624f48

19 files changed

Lines changed: 912 additions & 14 deletions

File tree

.github/workflows/build-and-push-images.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
tags:
99
- "v*"
1010
pull_request:
11+
workflow_dispatch:
1112

1213
jobs:
1314
build-and-publish:
@@ -16,7 +17,7 @@ jobs:
1617
runs-on: oracle-vm-16cpu-64gb-x86-64
1718

1819
env:
19-
SHOULD_PUBLISH: ${{ github.event_name == 'push' }}
20+
SHOULD_PUBLISH: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
2021

2122
strategy:
2223
fail-fast: false

.github/workflows/check-pr-title.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ jobs:
4242
ignoreLabels: |
4343
do-not-merge/work-in-progress
4444
dependencies
45+
area/release
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Check Release
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- VERSION
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
SEMVER_PATTERN: '^(v)?([0-9]+)\.([0-9]+)\.([0-9]+)(-rc\.([0-9]+))?$'
16+
CHART_FILE: charts/kubeflow-trainer/Chart.yaml
17+
PY_API_VERSION_FILE: api/python_api/kubeflow_trainer_api/__init__.py
18+
19+
jobs:
20+
check:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout source code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Parse version and export env vars
30+
run: |
31+
RAW_VERSION=$(cat VERSION | tr -d ' \n\r')
32+
VERSION=${RAW_VERSION#v}
33+
if [[ ${RAW_VERSION} =~ ${{ env.SEMVER_PATTERN }} ]]; then
34+
echo "Version '${RAW_VERSION}' matches semver pattern."
35+
else
36+
echo "Version '${RAW_VERSION}' does not match semver pattern."
37+
exit 1
38+
fi
39+
TAG="v${VERSION}"
40+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
41+
echo "TAG=${TAG}" >> $GITHUB_ENV
42+
43+
- name: Check if tag exists
44+
run: |
45+
git fetch --tags
46+
if git tag -l | grep -q "^${TAG}$"; then
47+
echo "Tag '${TAG}' already exists."
48+
exit 1
49+
else
50+
echo "Tag '${TAG}' does not exist."
51+
fi
52+
53+
- name: Check if manifests image tag matches version
54+
run: |
55+
MANIFEST_TAGS=$(grep -r 'newTag:' manifests | sed 's/.*newTag:[[:space:]]*//' | tr -d '"' | tr -d "'" | sort | uniq)
56+
if [ -z "$MANIFEST_TAGS" ]; then
57+
echo "No newTag found in manifests."
58+
exit 1
59+
fi
60+
for t in $MANIFEST_TAGS; do
61+
if [ "$t" != "$TAG" ]; then
62+
echo "Image tag in manifests ($t) does not match version tag ($TAG)."
63+
exit 1
64+
fi
65+
done
66+
echo "All image tags in manifests match version tag $TAG."
67+
68+
- name: Check Helm chart version
69+
run: |
70+
CHART_VERSION=$(grep -E '^version:' "$CHART_FILE" | head -n1 | awk '{print $2}')
71+
if [ -z "$CHART_VERSION" ]; then
72+
echo "Chart version not found in $CHART_FILE"
73+
exit 1
74+
fi
75+
if [ "$CHART_VERSION" != "$VERSION" ]; then
76+
echo "Chart version ($CHART_VERSION) does not match VERSION ($VERSION)."
77+
exit 1
78+
fi
79+
echo "Chart version matches VERSION ($VERSION)."
80+
81+
- name: Check Python API version
82+
run: |
83+
PY_VER=$(python - <<'PY'
84+
import os
85+
import re
86+
import sys
87+
from pathlib import Path
88+
path = Path(os.environ["PY_API_VERSION_FILE"])
89+
text = path.read_text()
90+
match = re.search(r"__version__\s*=\s*['\"]([^'\"]+)['\"]", text)
91+
if not match:
92+
print("__version__ not found", file=sys.stderr)
93+
sys.exit(1)
94+
print(match.group(1))
95+
PY
96+
)
97+
if [ "$PY_VER" != "$VERSION" ]; then
98+
echo "Python API version ($PY_VER) does not match VERSION ($VERSION)."
99+
exit 1
100+
fi
101+
echo "Python API version matches VERSION ($VERSION)."
102+
103+
- name: Check configmap version in manager overlay
104+
run: |
105+
MANAGER_KUSTOMIZE="manifests/overlays/manager/kustomization.yaml"
106+
if [ ! -f "$MANAGER_KUSTOMIZE" ]; then
107+
echo "Manager kustomization not found: $MANAGER_KUSTOMIZE"
108+
exit 1
109+
fi
110+
CM_VERSION=$(grep 'kubeflow_trainer_version=' "$MANAGER_KUSTOMIZE" | sed 's/.*kubeflow_trainer_version=//' | tr -d ' \t')
111+
if [ -z "$CM_VERSION" ]; then
112+
echo "kubeflow_trainer_version not found in $MANAGER_KUSTOMIZE."
113+
exit 1
114+
fi
115+
if [ "$CM_VERSION" != "$TAG" ]; then
116+
echo "Configmap version ($CM_VERSION) does not match version tag ($TAG)."
117+
exit 1
118+
fi
119+
echo "Configmap version matches version tag $TAG."
120+
121+
- name: Check data-cache image is pinned
122+
run: |
123+
UNPINNED=$(grep -rn 'ghcr\.io/kubeflow/trainer/[A-Za-z0-9._/-]*:latest' manifests || true)
124+
if [ -n "$UNPINNED" ]; then
125+
echo "Found unpinned :latest image references in manifests:"
126+
echo "$UNPINNED"
127+
exit 1
128+
fi
129+
echo "All inline image references in manifests are pinned (no :latest)."

.github/workflows/publish-helm-charts.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- master
77
tags:
88
- "v*"
9+
workflow_dispatch:
910

1011
env:
1112
CHART_PATH: charts/kubeflow-trainer

.github/workflows/release.yaml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- VERSION
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: false
13+
14+
env:
15+
SEMVER_PATTERN: '^(v)?([0-9]+)\.([0-9]+)\.([0-9]+)(-rc\.([0-9]+))?$'
16+
17+
jobs:
18+
prepare:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
version: ${{ steps.vars.outputs.version }}
22+
tag: ${{ steps.vars.outputs.tag }}
23+
branch: ${{ steps.vars.outputs.branch }}
24+
is-prerelease: ${{ steps.vars.outputs.is-prerelease }}
25+
26+
steps:
27+
- name: Checkout source code
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Validate version and set outputs
33+
id: vars
34+
run: |
35+
RAW_VERSION=$(cat VERSION | tr -d ' \n\r')
36+
VERSION=${RAW_VERSION#v}
37+
if [[ ! ${RAW_VERSION} =~ ${{ env.SEMVER_PATTERN }} ]]; then
38+
echo "Version '${RAW_VERSION}' does not match semver pattern."
39+
exit 1
40+
fi
41+
42+
MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2)
43+
BRANCH="release-${MAJOR_MINOR}"
44+
TAG="v${VERSION}"
45+
IS_PRERELEASE=false
46+
if [[ ${VERSION} == *"-rc."* ]]; then
47+
IS_PRERELEASE=true
48+
fi
49+
50+
echo "Version '${RAW_VERSION}' matches semver pattern."
51+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
52+
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
53+
echo "tag=${TAG}" >> $GITHUB_OUTPUT
54+
echo "is-prerelease=${IS_PRERELEASE}" >> $GITHUB_OUTPUT
55+
56+
- name: Ensure tag does not exist
57+
run: |
58+
git fetch --tags
59+
if git tag -l | grep -q "^${{ steps.vars.outputs.tag }}$"; then
60+
echo "Tag '${{ steps.vars.outputs.tag }}' already exists."
61+
exit 1
62+
fi
63+
64+
- name: Check manifests image tag matches version
65+
run: |
66+
TAG="${{ steps.vars.outputs.tag }}"
67+
MANIFEST_TAGS=$(grep -r 'newTag:' manifests | sed 's/.*newTag:[[:space:]]*//' | tr -d '"' | tr -d "'" | sort | uniq)
68+
if [ -z "$MANIFEST_TAGS" ]; then
69+
echo "No newTag found in manifests."
70+
exit 1
71+
fi
72+
for t in $MANIFEST_TAGS; do
73+
if [ "$t" != "$TAG" ]; then
74+
echo "Image tag in manifests ($t) does not match version tag ($TAG)."
75+
exit 1
76+
fi
77+
done
78+
echo "All image tags in manifests match version tag $TAG."
79+
80+
create_branch_and_tag:
81+
needs:
82+
- prepare
83+
runs-on: ubuntu-latest
84+
permissions:
85+
contents: write
86+
87+
steps:
88+
- name: Checkout source code
89+
uses: actions/checkout@v4
90+
with:
91+
fetch-depth: 0
92+
93+
- name: Configure Git
94+
run: |
95+
git config user.name "GitHub Actions"
96+
git config user.email "actions@github.com"
97+
98+
- name: Create release branch
99+
run: |
100+
BRANCH="${{ needs.prepare.outputs.branch }}"
101+
git fetch origin
102+
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
103+
echo "Release branch $BRANCH already exists."
104+
else
105+
echo "Creating release branch $BRANCH from $GITHUB_SHA"
106+
git checkout -b "$BRANCH" "$GITHUB_SHA"
107+
git push origin "$BRANCH"
108+
fi
109+
110+
- name: Create and push tag
111+
run: |
112+
git tag -a "${{ needs.prepare.outputs.tag }}" "$GITHUB_SHA" -m "Kubeflow Trainer ${{ needs.prepare.outputs.tag }}"
113+
git push origin "${{ needs.prepare.outputs.tag }}"
114+
115+
trigger_builds:
116+
needs:
117+
- prepare
118+
- create_branch_and_tag
119+
runs-on: ubuntu-latest
120+
permissions:
121+
actions: write
122+
123+
steps:
124+
- name: Trigger image build for release tag
125+
uses: actions/github-script@v7
126+
with:
127+
script: |
128+
await github.rest.actions.createWorkflowDispatch({
129+
owner: context.repo.owner,
130+
repo: context.repo.repo,
131+
workflow_id: 'build-and-push-images.yaml',
132+
ref: '${{ needs.prepare.outputs.tag }}',
133+
})
134+
135+
- name: Trigger Helm chart publish for release tag
136+
uses: actions/github-script@v7
137+
with:
138+
script: |
139+
await github.rest.actions.createWorkflowDispatch({
140+
owner: context.repo.owner,
141+
repo: context.repo.repo,
142+
workflow_id: 'publish-helm-charts.yaml',
143+
ref: '${{ needs.prepare.outputs.tag }}',
144+
})
145+
146+
github_release:
147+
needs:
148+
- prepare
149+
- trigger_builds
150+
permissions:
151+
contents: write
152+
runs-on: ubuntu-latest
153+
154+
steps:
155+
- name: Checkout
156+
uses: actions/checkout@v4
157+
with:
158+
fetch-depth: 0
159+
160+
- name: Generate changelog
161+
id: changelog
162+
uses: orhun/git-cliff-action@v4
163+
with:
164+
config: cliff.toml
165+
args: --latest --tag ${{ needs.prepare.outputs.tag }}
166+
env:
167+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168+
169+
- name: Create GitHub Release
170+
uses: softprops/action-gh-release@v2
171+
with:
172+
token: ${{ secrets.GITHUB_TOKEN }}
173+
name: "Kubeflow Trainer ${{ needs.prepare.outputs.tag }}"
174+
tag_name: ${{ needs.prepare.outputs.tag }}
175+
target_commitish: ${{ github.sha }}
176+
prerelease: ${{ needs.prepare.outputs.is-prerelease == 'true' }}
177+
draft: false
178+
body: ${{ steps.changelog.outputs.content }}

.github/workflows/template-publish-image/action.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ runs:
8282
images: ${{ inputs.image }}
8383
tags: |
8484
type=ref,event=tag
85+
type=raw,value=${{ github.ref_name }},enable=${{ github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/') }}
8586
type=raw,value=latest,enable={{is_default_branch}}
8687
type=sha
8788

0 commit comments

Comments
 (0)