MetaMask / action-publish-release

MIT License
12 stars 6 forks source link

Support monorepos without synchronized versions #45

Closed Gudahtt closed 1 year ago

Gudahtt commented 2 years ago

Currently this action only supports monorepos with synchronized versions. We will soon be using monorepos that don't use synchronized versions, so this will need to be updated to support that.

mcmire commented 2 years ago

Here are my thoughts on what sort of changes we could make to this action in order to achieve this goal.

Disclaimer

It's important to know up front that right now this action reads the version we want to release (the "release version") from the branch being merged. This is being changed in #46 to read from the version in package.json, so we will assume that.

Current flow

Once we know what the release version is, we follow one of two workflows:

Polyrepo

Monorepo

New flow

For polyrepos, everything should work how it works now.

But for monorepos, there's a problem with the existing flow: it assumes that when a release is created, all packages will be bumped to the same version. This may continue to be true for snaps-skunkworks and eslint-config, but will not be true for controllers, because we will be following an independent versioning strategy, where 1) every package can have a different version and 2) not every package may be bumped when a new release is issued.

Therefore, the changes we need to make are as follows:

Decisions to make

In summary, here are the things we need to decide, in the case of a monorepo with an independent versioning strategy:

Prior art

For inspiration, take a look at Vercel, which more or less follows the same process that we want to follow: https://github.com/vercel/vercel

mcmire commented 2 years ago

Just an update on this: Instead of having this action take a second input, we should read the value of versionSynchronizationStrategy from some sort of configuration object that is kept in the repo as described here: https://github.com/MetaMask/create-release-branch/blob/88ec7e222c8c8e3fa88534c0ebda331a117911db/docs/setup.md. @rickycodes and I are discussing in Slack whether this configuration object lives in package.json or in a separate file entirely, so until that's resolved we can work around it for now by continuing to have a second action input, and then tweak it in a later PR.

mcmire commented 2 years ago

Another update: instead of using a version format of <year>.<month>.<day>-<release number> for the root package, we should use <yyyy><mm><dd>.<release number>.0, so that we don't create a prerelease version.

mcmire commented 2 years ago

Here's the relevant part of the Notion doc which describes how this action fits into the larger workflow. This might be helpful to gain more context: https://www.notion.so/Core-Monorepo-Release-Automation-a65b28ab89a14c9d82dcf9fabc3eb1e1#aa00c0fc1e404448884f41c4998602e6