Skip to content

Commit 584853e

Browse files
committed
Add a workflow to tag a release
1 parent 0921933 commit 584853e

2 files changed

Lines changed: 61 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -19,8 +19,8 @@ on:
1919
- cuda-pathfinder
2020
- cuda-python
2121
- all
22-
git-tag:
23-
description: "The release git tag"
22+
version:
23+
description: "Version to release (e.g. 1.2.3)"
2424
required: true
2525
type: string
2626
run-id:
@@ -39,6 +39,9 @@ on:
3939
- testpypi
4040
- pypi
4141

42+
env:
43+
TAG: ${{ fromJSON('{"cuda_bindings":"v","cuda_core":"cuda-core-v","cuda_pathfinder":"cuda-pathfinder-v","cuda_python":"cuda-python-v","all":"all-v"}')[inputs.component] }}${{ inputs.version }}
44+
4245
defaults:
4346
run:
4447
shell: bash --noprofile --norc -xeuo pipefail {0}
@@ -64,8 +67,8 @@ jobs:
6467
echo "Using provided run ID: ${{ inputs.run-id }}"
6568
echo "run-id=${{ inputs.run-id }}" >> $GITHUB_OUTPUT
6669
else
67-
echo "Auto-detecting run ID for tag: ${{ inputs.git-tag }}"
68-
RUN_ID=$(./ci/tools/lookup-run-id "${{ inputs.git-tag }}" "${{ github.repository }}")
70+
echo "Auto-detecting run ID for tag: ${{ env.TAG }}"
71+
RUN_ID=$(./ci/tools/lookup-run-id "${{ env.TAG }}" "${{ github.repository }}")
6972
echo "Auto-detected run ID: $RUN_ID"
7073
echo "run-id=$RUN_ID" >> $GITHUB_OUTPUT
7174
fi
@@ -93,8 +96,8 @@ jobs:
9396
9497
found=0
9598
for idx in ${!tags[@]}; do
96-
if [[ "${tags[$idx]}" == "${{ inputs.git-tag }}" ]]; then
97-
echo "found existing release for ${{ inputs.git-tag }}"
99+
if [[ "${tags[$idx]}" == "${{ env.TAG }}" ]]; then
100+
echo "found existing release for ${{ env.TAG }}"
98101
found=1
99102
if [[ "${is_draft[$idx]}" != "true" ]]; then
100103
echo "the release note is not in draft state"
@@ -104,8 +107,8 @@ jobs:
104107
fi
105108
done
106109
if [[ "$found" == 0 ]]; then
107-
echo "no release found for ${{ inputs.git-tag }}, creating draft release"
108-
gh release create "${{ inputs.git-tag }}" --draft --repo "${{ github.repository }}" --title "Release ${{ inputs.git-tag }}" --notes "Release ${{ inputs.git-tag }}"
110+
echo "no release found for ${{ env.TAG }}, creating draft release"
111+
gh release create "${{ env.TAG }}" --draft --repo "${{ github.repository }}" --title "Release ${{ env.TAG }}" --notes "Release ${{ env.TAG }}"
109112
fi
110113
111114
doc:
@@ -124,7 +127,7 @@ jobs:
124127
with:
125128
build-ctk-ver: ${{ inputs.build-ctk-ver }}
126129
component: ${{ inputs.component }}
127-
git-tag: ${{ inputs.git-tag }}
130+
git-tag: ${{ vars.TAG }}
128131
run-id: ${{ needs.determine-run-id.outputs.run-id }}
129132
is-release: true
130133

@@ -139,7 +142,7 @@ jobs:
139142
secrets: inherit
140143
uses: ./.github/workflows/release-upload.yml
141144
with:
142-
git-tag: ${{ inputs.git-tag }}
145+
git-tag: ${{ vars.TAG }}
143146
run-id: ${{ needs.determine-run-id.outputs.run-id }}
144147
component: ${{ inputs.component }}
145148

.github/workflows/tag-release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Tag Release
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
component:
11+
description: "Component to tag (cuda_bindings implies cuda_python as well)"
12+
required: true
13+
type: choice
14+
options:
15+
- cuda_bindings
16+
- cuda_core
17+
- cuda_pathfinder
18+
version:
19+
description: "Version to tag (e.g. 1.2.3)"
20+
required: true
21+
type: string
22+
23+
jobs:
24+
tag-release:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: write
28+
env:
29+
TAG: ${{ fromJSON('{"cuda_bindings":"v","cuda_core":"cuda-core-v","cuda_pathfinder":"cuda-pathfinder-v"}')[inputs.component] }}${{ inputs.version }}
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Configure git
35+
run: |
36+
git config user.name "github-actions[bot]"
37+
git config user.email "github-actions[bot]@users.noreply.github.com"
38+
39+
- name: Create empty commit and tag
40+
run: |
41+
git commit --allow-empty -m "Release ${TAG}"
42+
git tag "${TAG}"
43+
44+
- name: Push commit and tag
45+
run: |
46+
git push origin main
47+
git push origin "${TAG}"

0 commit comments

Comments
 (0)