Skip to content

Commit f606acd

Browse files
authored
ci(release): add auto-tag workflow for patch version bumping (#307)
1 parent d393e71 commit f606acd

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Release Auto-Tag
5+
6+
on:
7+
workflow_dispatch: {}
8+
# schedule:
9+
# - cron: "0 3 * * *" # 7 PM PT (03:00 UTC during PDT)
10+
11+
permissions:
12+
contents: write
13+
14+
concurrency:
15+
group: release-auto-tag
16+
cancel-in-progress: false
17+
18+
jobs:
19+
create-tag:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Determine next patch version
27+
id: version
28+
run: |
29+
latest=$(git tag -l 'v*.*.*' --sort=-v:refname | head -1)
30+
if [ -z "$latest" ]; then
31+
echo "::error::No existing v*.*.* tags found"
32+
exit 1
33+
fi
34+
echo "Latest tag: $latest"
35+
36+
major=$(echo "$latest" | sed 's/^v//' | cut -d. -f1)
37+
minor=$(echo "$latest" | sed 's/^v//' | cut -d. -f2)
38+
patch=$(echo "$latest" | sed 's/^v//' | cut -d. -f3)
39+
next="v${major}.${minor}.$((patch + 1))"
40+
41+
if git tag -l "$next" | grep -q .; then
42+
echo "::error::Tag $next already exists"
43+
exit 1
44+
fi
45+
46+
echo "next=$next" >> "$GITHUB_OUTPUT"
47+
echo "Next tag: $next"
48+
49+
- name: Create and push tag
50+
run: |
51+
git tag ${{ steps.version.outputs.next }}
52+
git push origin ${{ steps.version.outputs.next }}

0 commit comments

Comments
 (0)