Skip to content
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 script #1748

Merged
merged 36 commits into from
Jan 8, 2024
Merged

Add a release script #1748

merged 36 commits into from
Jan 8, 2024

Conversation

yannham
Copy link
Member

@yannham yannham commented Jan 3, 2024

This PR adds a script to automate most of of the releasing process (which is becoming tedious).

The steps covered are:

  • Bumping version numbers (including local cross-dependencies, and handling local crates that don't follow the version scheme of the workspace)
  • Running checks (nix flake check currently)
  • Creating and pushing the release branch, and make the stable branch point to it (after saving the previous stable branch)
  • Performing the required pre-processing before publication to crates.io: remove nickel-lang-utils from dependencies, remove the various format features, remove "format" from default features, and remove the dependencies associated to "format"
  • Perform checks (--dry-run) and then publish on crates.io

I've tried to inform the user as much as possible, and to gracefully recover in case of error.

This scripts has been tested by parts (commenting out destructive actions like pushing the stable branch or aborting before actually publishing to crates.io), and in different situations manually. I'd still like to get reviews before using it for the 1.4 release, so that I can try the version including review suggestions in real conditions (and avoid having bugs resurfacing when releasing 1.5).

Afterthought

I initially thought I could use tomlq to patch the various Cargo.toml files in place. It's true in theory, but tomlq works by parsing content, transcoding to JSON, using jq for processing, and transcodes back the result to TOML. Needless to say, even if the result is semantically correct, it totally messes up the original formatting and layout of the files, as well as removing all comments, which is unacceptable.

I ended up using sed/awk for modification instead, which is obviously more fragile. Now, if I was to start again, I would consider something like a stand-alone python script (given that there's a library to do what I want, that is localized programmatic modification of TOML). For now this script should be sufficient, but if we need to evolve it in the future, this might be a consideration to keep in mind.

TODO

  • re-entrancy once we successfully pushed the x.x.x branch but failed to publish

Future work

  • add the script's dependencies to the devshell, (mostly tomlq, beyond basic utilities)

First draft of a release script to automate most of the painful details
of releasing a new version of Nickel and associated crates.
@github-actions github-actions bot temporarily deployed to pull request January 3, 2024 19:24 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 09:45 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 10:17 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 10:43 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 15:03 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 15:58 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 16:58 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 17:11 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 17:21 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 18:40 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 18:52 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 4, 2024 19:05 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 10:03 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 10:17 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 10:41 Inactive
@yannham yannham marked this pull request as ready for review January 5, 2024 11:04
@github-actions github-actions bot temporarily deployed to pull request January 5, 2024 11:08 Inactive
@yannham yannham added this to the Next minor (1.4) milestone Jan 5, 2024
Copy link
Member

@jneem jneem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to have this automated!

Did you see if there's anything useful that cargo release has to offer? The topiary stuff probably means we can't just use it out-of-the-box, but for example the cargo release version subcommand might get rid of the version-related sed stuff.

RELEASING.md Outdated Show resolved Hide resolved
Co-authored-by: jneem <joeneeman@gmail.com>
@yannham
Copy link
Member Author

yannham commented Jan 8, 2024

Did you see if there's anything useful that cargo release has to offer?

I haven't looked at it. Thanks for the suggestion, I'll see if it can make some parts of the script simpler!

@github-actions github-actions bot temporarily deployed to pull request January 8, 2024 08:09 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 8, 2024 08:47 Inactive
@yannham yannham added this pull request to the merge queue Jan 8, 2024
Merged via the queue into master with commit 1dd4deb Jan 8, 2024
5 checks passed
@yannham yannham deleted the ops/release-script branch January 8, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants