-
Notifications
You must be signed in to change notification settings - Fork 129
Use crates.io Trusted publishing to publish releases to crates.io #678
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
base: main
Are you sure you want to change the base?
Conversation
Let's continue the discussion from #677 here. If we switch to consistently using crates.io releases, then technically we don't need to build and release a prebuilt version of mozjs-sys for every commit on main, but just for every published release. I've been wondering about the versioning too - perhaps we should just use a workspace version (following the spidermonkey version, as we already do for mozjs-sys), and not version mozjs independently? That would make version bumps simpler, and we could always just release both libraries. It would be a bit wasteful (in terms of crates.io space usage) if mozjs-sys didn't actually change though. |
Signed-off-by: Jonathan Schwender <[email protected]>
d5c11af to
c52dc84
Compare
.github/workflows/publish.yml
Outdated
| - verify-release | ||
| permissions: | ||
| id-token: write | ||
| if: ${{ needs.publish-github-release.outputs.create-release }} |
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.
cargo publish does nothing (it does not even build) if version number does not change, so maybe we can just remove if guard and let publish happen on any version bump (this should also handle bumping just mozjs).
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 just checked and cargo publish will exit with 101 when trying to publish an already published version.
I pushed a commit which uses grep to check the error message, and will keep the pipeline greep if the failure is due to the release already existing.
That's what we are actually already doing. New releases are not created per commit, but per mozjs-sys bumps (which are enforced by CI due to artifacts).
I give this more though and if think current rules are good enough (CI enforced bumps of mozjs-sys) and manually handled bumps of mozjs. Alternatively we could enforce bumps of mozjs too, but they should remain independent of mozjs-sys. Although common versioning schema does sound nice, if would allow independent releases of mozjs. |
Signed-off-by: Jonathan Schwender <[email protected]>
46daba6 to
50a5b79
Compare
Depends on #676 and #677
See the official crates.io trusted publishing documentation.
This requires a crates.io owner of mozjs to allow trusted-publishing!
Todo: