-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add a release workflow to GitHub Actions #257
Conversation
prerelease: true | ||
body: TBD | ||
allowUpdates: true | ||
updateOnlyUnreleased: true |
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.
We can do this with gh
, but the action is helpful because of these allowUpdates
and updateOnlyUnreleased
properties.
This action is also used in cargo-dist
(and therefore we use it in ruff
and uv
), so feels well-trodden.
# Push the tag to GitHub. | ||
- name: Push tag | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
run: git push origin ${{ github.event.inputs.tag }} |
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.
It took me a long time to figure this out, but it seems that you cannot create a GitHub Release from an action by specifying a commit and tag. I fought 403 errors endlessly (omitting the commit worked without error), regardless of whether I used the gh
CLI or the action below. So, ultimately, I now have to create and push the tag, then create a release by specifying just the tag.
@@ -48,7 +48,7 @@ async fn upload_release_artifact( | |||
dry_run: bool, | |||
) -> Result<()> { |
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.
The code changes in this file are just making upload_release_artifact
more robust in dry-run, such that if the release itself doesn't exist, it can still do some validation.
I'm going to bias towards merging this so that I can use it for an upcoming release. |
Summary
This PR moves the release workflow to GitHub Actions, which removes the need for wrangling PATs and other access controls locally.
Specifically, we now have a "Release" workflow that runs via
workflow_dispatch
, and accepts the commit SHA and the tag as arguments. You can run the workflow on a specific branch, which defaults tomain
, so the commit on which the release workflow runs does not need to match the commit being released, which IMO is a nice property.The workflow is idempotent, such that it's safe to re-run with the same commit and tag if the release has already started, or completed, or failed partway through.
There's also a "dry-run" mode that avoids creating the release or uploading any artifacts. (If the release does exist, it will go a bit "further" in the process.)
Closes #253.
Closes #256.
Test Plan
This took an embarrassing amount of trial and error, but feels pretty good now.