-
Notifications
You must be signed in to change notification settings - Fork 515
72 lines (60 loc) · 2.11 KB
/
release-auto-tag.yml
File metadata and controls
72 lines (60 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Release Auto-Tag
on:
workflow_dispatch: {}
schedule:
- cron: "0 14 * * 1-5" # 7 AM PDT, weekdays only
permissions:
contents: write
actions: write
concurrency:
group: release-auto-tag
cancel-in-progress: false
jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine next patch version
id: version
run: |
latest=$(git tag -l 'v*.*.*' --sort=-v:refname | head -1)
if [ -z "$latest" ]; then
echo "::error::No existing v*.*.* tags found"
exit 1
fi
echo "Latest tag: $latest"
# Skip if no new commits since the latest tag
commit_count=$(git rev-list "${latest}..HEAD" --count)
echo "Commits since $latest: $commit_count"
if [ "$commit_count" -eq 0 ]; then
echo "No new commits since $latest — skipping tag creation"
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
major=$(echo "$latest" | sed 's/^v//' | cut -d. -f1)
minor=$(echo "$latest" | sed 's/^v//' | cut -d. -f2)
patch=$(echo "$latest" | sed 's/^v//' | cut -d. -f3)
next="v${major}.${minor}.$((patch + 1))"
if git tag -l "$next" | grep -q .; then
echo "::error::Tag $next already exists"
exit 1
fi
echo "next=$next" >> "$GITHUB_OUTPUT"
echo "Next tag: $next"
- name: Create and push tag
if: steps.version.outputs.skip != 'true'
run: |
git tag ${{ steps.version.outputs.next }}
git push origin ${{ steps.version.outputs.next }}
- name: Trigger Release Tag workflow
if: steps.version.outputs.skip != 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh workflow run release-tag.yml \
--ref main \
-f tag=${{ steps.version.outputs.next }}