-
Notifications
You must be signed in to change notification settings - Fork 245
[REL]: Add a workflow to tag a release #1610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mdboom
wants to merge
2
commits into
NVIDIA:main
Choose a base branch
from
mdboom:add-tagging-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: Tag Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| component: | ||
| description: "Component to tag (cuda_bindings implies cuda_python as well)" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - cuda_bindings | ||
| - cuda_core | ||
| - cuda_pathfinder | ||
| version: | ||
| description: "Version to tag (e.g. 1.2.3)" | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| tag-release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| TAG: ${{ fromJSON('{"cuda_bindings":"v","cuda_core":"cuda-core-v","cuda_pathfinder":"cuda-pathfinder-v"}')[inputs.component] }}${{ inputs.version }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Create empty commit and tag | ||
| run: | | ||
| git commit --allow-empty -m "Release ${TAG}" | ||
| git tag "${TAG}" | ||
|
|
||
| - name: Push commit and tag | ||
| run: | | ||
| git push origin main | ||
| git push origin "${TAG}" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdboom @rwgk I like this file. Can we keep it so that no members on the team would ever need to manually push a tag to this repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file alone (without the change in the other file) is composable with #1606.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works for me. It's a bit on the heavy-handed side just for the tagging, but if we fold in some easy safety features I can see good value:
That would prevent oversights like we had in the release of cuda-bindings 13.1.0 (missing release notes under cuda-python).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leofang: At a minimum we need to update this so it doesn't create an empty commit (which is no longer needed after #1606). And if we do that, we also have ways to fix the race condition problem.
The race condition is: I wanted to create a release, so I go to the page to trigger this workflow, and then someone else merges a PR while the workflow is waiting to run. Now we've made a release with unintended content.
If we require the user of this workflow to specify a commit hash to tag, we avoid the race condition.
FWIW, even those the GitHub UI for creating a release tag doesn't do everything we need, has the ability to specify a commit in their design since it's a real issue:
And then the other thing to test is:
There are a bunch of rules about GitHub workflows triggering other workflows (to prevent infinite loops etc). This may not work -- we will need to test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I think about this further, another downside is that this workflow could only ever /validate/ the kinds of things @rwgk is suggesting. (If it needs to add a commit to add content to the repo, we are back to the problems outlined in the OP). Is it really useful to have a workflow just to validate these things when instead we could write a local script that could actually /do/ those things and then add the tag? (and the push would correctly and helpfully fail if main had been updated in the meantime)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just handled by #1606?