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 publication workflow using cargo workspaces #160

Closed
wants to merge 1 commit into from

Conversation

nicbus
Copy link
Member

@nicbus nicbus commented Dec 4, 2020

resuming from PR #143, here is a proposal to handle publishing via cargo workspaces

requirements

  • the cargo login token configured in github as a secret named CRATES_IO_TOKEN

proposed release steps

  • prepare the master branch for the release
  • create or update the release branch to be aligned with master
  • create a release commit (typically with the updated changelog) on the release branch, including a line that ends with "new version <version>" in the commit message (see example below)
  • push the release commit, triggering the workflow

what the workflow will do

  • checkout the release branch
  • get the new version from the commit message (e.g. 0.2.0-rc.2 in the example)
  • update crate versions and inter-dependencies (using exact versions for dependencies, with the = symbol)
  • commit and tag the version change, the tag will be prefixed with a v (e.g. v0.2.0-rc.2)
  • publish the packages to crates.io (using the token provided via github secrets)
  • merge and push the new commits to the master branch

other considerations

  • I started trying to trigger the workflow with a tag (e.g. rel0.2.0-rc.2) but it didn't work since a tag-triggered workflow can't push a new tag (e.g. v0.2.0-rc.2), as it's forbidden by github (to avoid workflow loops AFAIK)
  • I also re-wrote the inter-dependencies in the form <package> = { path = "<path>", version = "=<version>" } to avoid cargo ws version errors on lnpbp_derive of the kind failed to select a version for the requirement
  • the cargo ws version command produces some other errors of the same kind (see example below) but I left those as they are for now, since they appear related to the tokio/socket2 dependency issue (weren't there some days ago) and don't make cargo ws version or cargo ws publish fail

examples

commit message:

update changelog

 * new version 0.2.0-rc.2

cargo ws version error:

error: failed to select a version for the requirement `socket2 = "=0.3.15"`
candidate versions found which didn't match: 0.3.17, 0.3.16, 0.2.4, ...
location searched: crates.io index
required by package `lnpbp v0.2.0+2 (/home/dieeasy/git/lnp-bp/rust-lnpbp)`

conclusions

there surely are many improvements than can be done, like more and stricter checks to avoid release issues, but it should be a good starting point

let's discuss and optionally wait for a fix to #159 (and then document the final release procedure before merging)

@nicbus nicbus marked this pull request as draft December 4, 2020 18:28
@UkolovaOlga UkolovaOlga self-requested a review December 5, 2020 14:36
@UkolovaOlga UkolovaOlga added ci Continious integration enhancement Improvement to existing functionality or refactoring labels Dec 5, 2020
@dr-orlovsky
Copy link
Member

Solved by 9f5c179

@dr-orlovsky dr-orlovsky closed this Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continious integration enhancement Improvement to existing functionality or refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants