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

ci: automatically push to crates.io on release #462

Merged
merged 8 commits into from
Mar 24, 2023

Conversation

erwanor
Copy link
Contributor

@erwanor erwanor commented Feb 22, 2023

Closes: #463

Description

This PR adds a Release workflow that gets triggered when a semver-looking tag is pushed to main. The workflow focuses on running a release.sh script which handles deploying crates/* to crates.io. This is porting over work done by @thanethomson in tendermint-rs.


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@erwanor erwanor changed the title ci: automatically push to crates.io on release (wip) ci: automatically push to crates.io on release Feb 22, 2023
@erwanor erwanor marked this pull request as ready for review February 22, 2023 17:10
@erwanor
Copy link
Contributor Author

erwanor commented Feb 22, 2023

@plafer I cannot add you as a reviewer since I'm not part of the repo, so tagging you for visibility - ty!

Copy link
Contributor

@thanethomson thanethomson left a comment

Choose a reason for hiding this comment

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

For this to work, I'd suggest setting up a GitHub bot user of some kind to have owner-level access to this crate on crates.io, and then use that bot account to create an API token and add it as the CRATES_TOKEN secret here.

We did this with our bftbot user for tendermint-rs.

release.sh Outdated
# A space-separated list of all the crates we want to publish, in the order in
# which they must be published. It's important to respect this order, since
# each subsequent crate depends on one or more of the preceding ones.
DEFAULT_CRATES="ibc"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure we need this whole script if only a single package is being published. One could easily, in the workflow file, simply run something like:

cargo publish -p ibc --token ${{secrets.CRATES_TOKEN}}

This script is necessary for tendermint-rs because of the crate interdependencies, and because after publishing a crate and successfully confirming via the crates.io API that the new crate version has been published, subsequent crates that depend on it still fail to be built sometimes for some reason (my guess is that they haven't managed to propagate through the CDN yet).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought this was a good default, but maybe it's best to go for the one-liner indeed

.github/workflows/release.yml Outdated Show resolved Hide resolved
@plafer
Copy link
Contributor

plafer commented Feb 23, 2023

thank you for this PR, I really appreciate it! I'll get to it as soon as I can

Comment on lines 2 to 5
# Attempts to perform a release when a particular tag is pushed. This uses the
# release.sh script in the root of the repository, and assumes that the
# CRATES_TOKEN secret has been set and contains an API token with which we can
# publish our crates to crates.io.
Copy link
Contributor

Choose a reason for hiding this comment

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

We no longer use the script; can you update this comment accordingly?

CONTRIBUTING.md Outdated
@@ -272,4 +267,5 @@ Our release process is as follows:
10. Once the tag is pushed, create a GitHub release and append
Copy link
Contributor

Choose a reason for hiding this comment

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

In 9. (I can't create a comment for that line), can we add

Pushing the tag will trigger the [Release workflow](https://github.com/cosmos/ibc-rs/actions/workflows/release.yml), which publishes the crate on crates.io.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also

  1. From the crates/ibc folder, run cargo publish

should be removed

@plafer
Copy link
Contributor

plafer commented Mar 16, 2023

hey @erwanor, if you give me write access to your branch, I'm happy to address the reviews comments

@erwanor
Copy link
Contributor Author

erwanor commented Mar 16, 2023

hey @plafer, sorry was ooo for a bit but I'm back and will review this later today. thanks for reaching out, appreciate it!!

@plafer
Copy link
Contributor

plafer commented Mar 16, 2023

Please take your time, this was meant to offer help, not rush you :)

@erwanor
Copy link
Contributor Author

erwanor commented Mar 24, 2023

Ok finally got around to address those changes, rebased onto main to fix the conflicts in the contributing docs. Thanks for your patience with this!

Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

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

awesome, thanks!

@plafer plafer merged commit 168288e into informalsystems:main Mar 24, 2023
Farhad-Shabani pushed a commit that referenced this pull request Sep 9, 2024
* ci: add deploy script

* ci: add `release` workflow

* docs(CONTRIBUTING): remove manual `html_root` ver bump

* docs(CONTRIBUTING): link the `Release` workflow directly

* action: update `.github/workflows/release.yml`

Co-authored-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Erwan <7871622+erwanor@users.noreply.github.com>

* ci: remove `release.sh`

* actions(release): update comment

* docs(CONTRIBUTING): remove old step + describe worfklow

---------

Signed-off-by: Erwan <7871622+erwanor@users.noreply.github.com>
Co-authored-by: Thane Thomson <connect@thanethomson.com>
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.

Automate the release process
4 participants