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

chore(ci): add a release-please configuration #630

Merged
merged 1 commit into from Jul 31, 2023

Conversation

boneskull
Copy link
Contributor

This adds configuration for releasing with the release-please action.

The way it works, in a nutshell:

  • a commit with a conventional commits-valid message gets merged into main
  • the action runs and creates one PR per package, with a new release ready to go, including updates to various CHANGELOGs, etc.
  • another commit is merged
  • the action either updates its existing PRs or creates new ones
  • once a release PR is merged, the github release happens automatically
  • the npm publish must be run manually by a human

@boneskull
Copy link
Contributor Author

boneskull commented Jul 25, 2023

Here's an example (not a monorepo): of a PR it would create: boneskull/midnight-smoker#238

And here's an example of what happens after you merge (with automatic publish to npm, which I manually configured): https://github.com/boneskull/midnight-smoker/actions/runs/5651165831/job/15308801239

Here's a GitHub Release it created and the associated update in the package's CHANGELOG.md

@boneskull
Copy link
Contributor Author

FWIW, for now, once you get over the configuration hump, release-please is pretty nice. It remains to be seen how well it works on a monorepo, but it was designed with that in mind.

@boneskull
Copy link
Contributor Author

boneskull commented Jul 25, 2023

note: I think we may need lerna after all here to publish manually. something like lerna publish from-package

this is done

@boneskull boneskull changed the base branch from boneskull/npm to boneskull/workspaces July 25, 2023 20:34
@boneskull
Copy link
Contributor Author

This PR now targets the "fiddle with Lerna" PR, as it's built on that foundation.

@boneskull boneskull self-assigned this Jul 25, 2023
@boneskull boneskull added the chore overhead, tests, dev env, etc. label Jul 25, 2023
@boneskull boneskull marked this pull request as ready for review July 27, 2023 07:57
@boneskull boneskull changed the title [DRAFT] chore(ci): add a release-please configuration chore(ci): add a release-please configuration Jul 27, 2023
@@ -3,7 +3,10 @@
"changelogPreset": "conventional-changelog-conventionalcommits",
"command": {
"publish": {
"message": "chore: publish"
"message": "chore: publish",
"fromPackage": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

does this mean e.g. for a lavamoat-core core update

since 4 other pkgs depend on it

we'll create 4 new separate-pull-requests to update them?
or these will be included in the original PR?

ref: https://lerna.js.org/docs/features/version-and-publish#from-package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@leotm I'm not sure I understand the context of asking this in the lerna config

release-please is configured to create separate pull requests for each public workspace (package). we are in control of how or when those get merged, and are also in control of how or when those get finally published. but they all must be published at once!

so when we merge a change to lavamoat-core, a PR is created for that. once that PR is merged, then PRs will be created for each of the packages which depend on the new version of lavamoat-core. it would be a mistake to merge and publish those before publishing the new version of lavamoat-core since they will not exist in the registry. because lerna is configured to publish everything that needs publishing, we avoid this problem. so publishing in any other way besides this is just asking for trouble.

This may be why the default behavior of release-please is to not create separate pull requests, because it may become confusing. if it turns out we don't like separate PRs, I propose we simply...disable this behavior. 😄

cc @naugtur @legobeat @weizman just so you see this

Copy link
Contributor

@leotm leotm left a comment

Choose a reason for hiding this comment

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

some comments no blockers 👍

@boneskull boneskull force-pushed the boneskull/release-please branch 2 times, most recently from 39090de to 739366e Compare July 28, 2023 17:46
This encodes the proper `lerna publish` flags within `lerna.json`.  `release-please` will handle creating the GitHub release and updating the changelog, and we just want Lerna to publish what we have.

These flags are essentially the same thing we have currently, sans the `--yes` flag.
@boneskull boneskull changed the base branch from boneskull/workspaces to boneskull/npm July 31, 2023 18:24
@boneskull boneskull merged commit d4dd2ce into boneskull/npm Jul 31, 2023
6 checks passed
@boneskull boneskull deleted the boneskull/release-please branch July 31, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore overhead, tests, dev env, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants