|
1 | 1 | # Using the tool in a monorepo with independent versions
|
2 | 2 |
|
3 |
| -For a monorepo using an "independent" versioning strategy, the tool needs to know which packages you want to release and how to set the version for each package. |
| 3 | +For a monorepo using an "independent" versioning strategy, the tool needs to know two things: |
| 4 | + |
| 5 | +1. Which packages you want to release and how to set the version for each package. |
| 6 | +2. Whether or not you are creating a backport release as opposed to an "ordinary" release. |
| 7 | + |
| 8 | +## Ordinary release |
| 9 | + |
| 10 | +Typically, a new release will follow the most recent release (that is, the changes within the release are applied to the code in the most recent release). We call this an _ordinary_ release. |
4 | 11 |
|
5 | 12 | Start by running:
|
6 | 13 |
|
@@ -33,9 +40,26 @@ Once you've filled out the release spec, save and close it, and the tool will co
|
33 | 40 |
|
34 | 41 | At this point, the tool will:
|
35 | 42 |
|
36 |
| -1. Calculate a new release version by extracting the build number from the current version, incrementing it, and combining it with the current date, then setting the `version` of the root package to this new version. |
| 43 | +1. Calculate a new release version by incrementing the "ordinary" (first) number of the current version, then set the `version` of the root package to this new version. |
37 | 44 | 2. Go through each workspace package specified, and:
|
38 |
| - 1. Adjust the `version` of the package to the version specified. |
| 45 | + 1. Calculate a new version of the package that you specified in the release spec, then set the `version` of the package to this new version. |
39 | 46 | 2. Read the Git history of the repo to extract the names of the commits which have made any changes to any files within the package since the Git tag that corresponds to the current version of the package.
|
40 | 47 | 3. Add a new section to the changelog for the package which is titled by the release version and which lists the commits gathered.
|
41 |
| -3. Commit the changes to a new branch called `release/<release-version>`, where `<release-version>` is the version calculated in step one (e.g. `release/2022.6.8-123`), and switch to that branch. |
| 48 | +3. Commit the changes to a new branch called `release/<release-version>`, where `<release-version>` is the version calculated in step one (e.g. `release/5.0.0`), then switch to that branch. |
| 49 | + |
| 50 | +## Backport release |
| 51 | + |
| 52 | +Sometimes you will need to create a release which contains a change, such as an important fix, to a pre-existing release. We call this a _backport_ release. |
| 53 | + |
| 54 | +The process for creating a backport release works the same as an ordinary release, except before you run the tool, you will switch to a branch that represents an "alternative timeline" based off a past version (for instance, you might have previously cut a branch that continues the 1.x line of the project, even though the latest version is 2.x). |
| 55 | + |
| 56 | +> **Note** |
| 57 | +> It's necessary to be on another branch and not the main line, because `create-release-branch` uses the version of packages as they exist on the current branch, and not the latest published versions, to determine the release version and to populate changelogs correctly. |
| 58 | +
|
| 59 | +Once on this branch, run: |
| 60 | + |
| 61 | +``` |
| 62 | +create-release-branch --backport |
| 63 | +``` |
| 64 | + |
| 65 | +In this case, the new release version will be calculated by incrementing the "backport" (second) number of the current version, but the versions and changelogs of workspace packages will still be updated according to the release spec. |
0 commit comments