Skip to content

Commit f4ddd36

Browse files
committed
update and automate release notes
1 parent f10b144 commit f4ddd36

5 files changed

Lines changed: 157 additions & 3 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Copyright 2026 "Google LLC"
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Draft CTK Release
16+
17+
on:
18+
pull_request:
19+
types:
20+
- ready_for_review
21+
branches:
22+
- main
23+
24+
permissions:
25+
contents: write
26+
27+
jobs:
28+
draft-release:
29+
if: |
30+
startsWith(github.event.pull_request.head.ref, 'release-candidate-') ||
31+
startsWith(github.event.pull_request.head.ref, 'hotfix-')
32+
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Checkout Repository
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Get Release Information
42+
id: release
43+
shell: bash
44+
run: |
45+
BRANCH="${{ github.event.pull_request.head.ref }}"
46+
47+
if [[ "$BRANCH" == release-candidate-* ]]; then
48+
VERSION="${BRANCH#release-candidate-}"
49+
elif [[ "$BRANCH" == hotfix-* ]]; then
50+
VERSION="${BRANCH#hotfix-}"
51+
else
52+
echo "Unsupported branch: $BRANCH"
53+
exit 1
54+
fi
55+
56+
echo "rc_branch=$BRANCH" >> "$GITHUB_OUTPUT"
57+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
58+
59+
- name: Create Draft Release
60+
uses: softprops/action-gh-release@v2
61+
with:
62+
tag_name: ${{ steps.release.outputs.version }}
63+
target_commitish: ${{ steps.release.outputs.rc_branch }}
64+
name: ${{ steps.release.outputs.version }}
65+
draft: true
66+
generate_release_notes: true
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr-label-validation.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ on:
3030
branches:
3131
- main
3232
- develop
33-
- release-candidate
33+
- release-candidate-*
34+
- hotfix-*
3435

3536
jobs:
3637
pr-label-validation:

.github/workflows/pr-precommit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ on:
2525
branches:
2626
- main
2727
- develop
28-
- release-candidate
28+
- release-candidate-*
2929
- hotfix-*
3030

3131
permissions:
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Copyright 2026 "Google LLC"
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Publish CTK Release
16+
17+
on:
18+
pull_request:
19+
types:
20+
- closed
21+
branches:
22+
- main
23+
24+
permissions:
25+
contents: write
26+
discussions: write
27+
28+
jobs:
29+
publish-release:
30+
if: >
31+
github.event.pull_request.merged == true &&
32+
(
33+
startsWith(github.event.pull_request.head.ref, 'release-candidate-') ||
34+
startsWith(github.event.pull_request.head.ref, 'hotfix-')
35+
)
36+
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Checkout Repository
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Get Release Version
46+
id: release
47+
shell: bash
48+
run: |
49+
RC_BRANCH="${{ github.event.pull_request.head.ref }}"
50+
51+
if [[ "$RC_BRANCH" == release-candidate-* ]]; then
52+
VERSION="${RC_BRANCH#release-candidate-}"
53+
elif [[ "$RC_BRANCH" == hotfix-* ]]; then
54+
VERSION="${RC_BRANCH#hotfix-}"
55+
else
56+
echo "Unsupported branch: $RC_BRANCH"
57+
exit 1
58+
fi
59+
60+
echo "rc_branch=$RC_BRANCH" >> "$GITHUB_OUTPUT"
61+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
62+
63+
- name: Create Tag
64+
run: |
65+
git config user.name "github-actions"
66+
git config user.email "github-actions@github.com"
67+
68+
if git rev-parse "${{ steps.release.outputs.version }}" >/dev/null 2>&1; then
69+
echo "Tag already exists"
70+
else
71+
git tag "${{ steps.release.outputs.version }}"
72+
git push origin "${{ steps.release.outputs.version }}"
73+
fi
74+
75+
- name: Publish GitHub Release
76+
uses: softprops/action-gh-release@v2
77+
with:
78+
tag_name: ${{ steps.release.outputs.version }}
79+
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
80+
name: ${{ steps.release.outputs.version }}
81+
generate_release_notes: true
82+
make_latest: true
83+
discussion_category_name: Announcements
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

tools/create-release-candidate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ esac
8686
NEW_VERSION="${NEW_MAJOR}.${NEW_MINOR}.${NEW_PATCH}"
8787
NEW_TAG="v${NEW_VERSION}"
8888

89-
RC_BRANCH=release-candidate
89+
RC_BRANCH="release-candidate-${NEW_TAG}"
9090
V_BRANCH="version/${NEW_TAG}"
9191
REMOTE_NAME=origin
9292

0 commit comments

Comments
 (0)