release: bump the IDL program version - #564
Conversation
joncinque
left a comment
There was a problem hiding this comment.
Looks great to me! This is a great way to solve the problem, and I tested that it works. Just some nits to make it more robust.
cc @lorisleiva since we've discussed some sort of action to do this in the past. This seems like a very neat and easy solution
|
|
||
| [package.metadata.release] | ||
| pre-release-replacements = [ | ||
| { file = "../idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 }, |
There was a problem hiding this comment.
nit: in case we end up changing the spacing, can we make this slightly more robust?
| { file = "../idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 }, | |
| { file = "../idl.json", search = '("publicKey":\s*"Stake11111111111111111111111111111111111111",\s*"version":\s*")[^"]+', replace = "${1}{{version}}", exactly = 1 }, |
| [package.metadata.release] | ||
| pre-release-replacements = [ | ||
| { file = "../idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 }, | ||
| { file = "../interface-idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 }, |
There was a problem hiding this comment.
nit: same here
| { file = "../interface-idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 }, | |
| { file = "../interface-idl.json", search = '("publicKey":\s*"Stake11111111111111111111111111111111111111",\s*"version":\s*")[^"]+', replace = "${1}{{version}}", exactly = 1 }, |
|
@joncinque If I understand correctly even though the Codama Macros already do use the |
No not quite, this bumps the IDL version to the new / correct version after the crate is released. Currently, every time we bump the interface crate version, we immediately get CI failures because the IDL version is out of sync. This will make it so we avoid that extra manual step every time. Unless the better option is to perform a post-bump step to re-run codama to pick up the newest version and commit it? |
|
We could also run the full script as |
That would have been my go-to solution yeah but I'm not sure how feasible it is to add this post-bump step to the Rust pipeline. |
I don't disagree but I'm also not a fan of the fact that we end up with two places to check when it comes to IDL generation. But again I'm not sure how complex that plumbing is in Rust so happy with the current solution is the trade-off is not worth it. |
|
Seems like it will boil down to something like this and the cost will be that the release pipeline needs to install the necessary tools... I agree this is cleaner, so let me prepare this one. |
|
We can avoid PRs like #572 if we land this, sooo anytime! |
fd0effd to
0561e3b
Compare
Problem The release bumps `interface/Cargo.toml` without touching the IDL files, so the IDL job fails after every release until someone regenerates them. Summary of Changes - regenerate both IDL files from a cargo-release pre-release hook, skipping dry runs - enable the shared workflow's `pnpm` input, since the hook needs pnpm - regenerate the IDL files for 5.1.1, since the last release left them at 5.1.0 Testing Ran `cargo release minor --execute --no-publish --no-push --no-tag` on a scratch branch, from the repo root and from `interface/`, and checked that each release commit carries both regenerated IDL files at the new version.
0561e3b to
77155c7
Compare
joncinque
left a comment
There was a problem hiding this comment.
Tested and confirming this works, thanks!
Problem
The release bumps
interface/Cargo.tomlwithout touching the IDL files, so the IDL job fails after every release until someone regenerates them.Summary of Changes
pnpminput, since the hook needs pnpmTesting
Ran
cargo release minor --execute --no-publish --no-push --no-tagon a scratch branch, from the repo root and frominterface/, and checked that each release commit carries both regenerated IDL files at the new version.