| 1 |
# Releasing an astroid version |
| 2 |
|
| 3 |
So, you want to release the `X.Y.Z` version of astroid ? |
| 4 |
|
| 5 |
## Releasing a major or minor version |
| 6 |
|
| 7 |
**Before releasing a major or minor version check if there are any unreleased commits on |
| 8 |
the maintenance branch. If so, release a last patch release first. See |
| 9 |
`Releasing a patch version`.** |
| 10 |
|
| 11 |
- Remove the empty changelog for the last unreleased patch version `X.Y-1.Z'`. (For |
| 12 |
example: `v2.3.5`) |
| 13 |
- Check the result of `git diff vX.Y-1.Z' ChangeLog`. (For example: |
| 14 |
`git diff v2.3.4 ChangeLog`) |
| 15 |
- Install the release dependencies: `pip3 install -r requirements_minimal.txt` |
| 16 |
- Bump the version and release by using `tbump X.Y.0 --no-push --no-tag`. (For example: |
| 17 |
`tbump 2.4.0 --no-push --no-tag`) |
| 18 |
- Check the commit created with `git show` amend the commit if required. |
| 19 |
- Move the `main` branch up to a dev version with `tbump`: |
| 20 |
|
| 21 |
```bash |
| 22 |
tbump X.Y+1.0-dev0 --no-tag --no-push # You can interrupt after the first step |
| 23 |
git commit -am "Upgrade the version to x.y+1.0-dev0 following x.y.0 release" |
| 24 |
``` |
| 25 |
|
| 26 |
For example: |
| 27 |
|
| 28 |
```bash |
| 29 |
tbump 2.5.0-dev0 --no-tag --no-push |
| 30 |
git commit -am "Upgrade the version to 2.5.0-dev0 following 2.4.0 release" |
| 31 |
``` |
| 32 |
|
| 33 |
Check the commit and then push to a release branch: |
| 34 |
|
| 35 |
- Open a merge request with the two commits (no one can push directly on `main`) |
| 36 |
- After the merge, recover the merged commits on `main` and tag the first one (the |
| 37 |
version should be `X.Y.Z`) as `vX.Y.Z` (For example: `v2.4.0`) |
| 38 |
- Push the tag. |
| 39 |
- Release the version on GitHub with the same name as the tag and copy and paste the |
| 40 |
appropriate changelog in the description. This triggers the PyPI release. |
| 41 |
- Delete the `maintenance/X.Y-1.x` branch. (For example: `maintenance/2.3.x`) |
| 42 |
- Create a `maintenance/X.Y.x` (For example: `maintenance/2.4.x` from the `v2.4.0` tag.) |
| 43 |
based on the tag from the release. The maintenance branch are protected you won't be |
| 44 |
able to fix it after the fact if you create it from main. |
| 45 |
|
| 46 |
## Backporting a fix from `main` to the maintenance branch |
| 47 |
|
| 48 |
Whenever a PR on `main` should be released in a patch release on the current maintenance |
| 49 |
branch: |
| 50 |
|
| 51 |
- Label the PR with `backport maintenance/X.Y-1.x`. (For example |
| 52 |
`backport maintenance/2.3.x`) |
| 53 |
- Squash the PR before merging (alternatively rebase if there's a single commit) |
| 54 |
- (If the automated cherry-pick has conflicts) |
| 55 |
- Add a `Needs backport` label and do it manually. |
| 56 |
- You might alternatively also: |
| 57 |
- Cherry-pick the changes that create the conflict if it's not a new feature before |
| 58 |
doing the original PR cherry-pick manually. |
| 59 |
- Decide to wait for the next minor to release the PR |
| 60 |
- In any case upgrade the milestones in the original PR and newly cherry-picked PR |
| 61 |
to match reality. |
| 62 |
- Release a patch version |
| 63 |
|
| 64 |
## Releasing a patch version |
| 65 |
|
| 66 |
We release patch versions when a crash or a bug is fixed on the main branch and has been |
| 67 |
cherry-picked on the maintenance branch. Below, we will be releasing X.Y-1.Z (where X.Y |
| 68 |
is the version under development on `main`.) |
| 69 |
|
| 70 |
- Branch `release/X.Y-1.Z` off of `maintenance/X.Y.x` |
| 71 |
- Check the result of `git diff vX.Y-1.Z-1 ChangeLog`. (For example: |
| 72 |
`git diff v2.3.4 ChangeLog`) |
| 73 |
- Install the release dependencies: `pip3 install -r requirements_minimal.txt` |
| 74 |
- Bump the version and release by using `tbump X.Y-1.Z --no-tag --no-push`. (For |
| 75 |
example: `tbump 2.3.5 --no-tag --no-push`. We're not ready to tag before code review.) |
| 76 |
- Check the result visually with `git show`. |
| 77 |
- Open a merge request against `maintenance/X.Y-1.x` to run the CI tests for this |
| 78 |
branch. |
| 79 |
- Consider copying the changelog into the body of the PR to examine the rendered |
| 80 |
markdown. |
| 81 |
- Wait for an approval. Avoid using a merge commit. Avoid deleting the maintenance |
| 82 |
branch. |
| 83 |
- Checkout `maintenance/X.Y.x` and fast-forward to the new commit. |
| 84 |
- Create and push the tag: `git tag vX.Y-1.Z` && `git push --tags` |
| 85 |
- Release the version on GitHub with the same name as the tag and copy and paste the |
| 86 |
appropriate changelog in the description. This triggers the PyPI release. |
| 87 |
- Freeze the main branch. |
| 88 |
- Branch `post-X.Y-1.Z` from `main`. |
| 89 |
- `git merge maintenance/X.Y-1.x`: this should have the changelog for `X.Y-1.Z+1` (For |
| 90 |
example `v2.3.6`). This merge is required so `pre-commit autoupdate` works for pylint. |
| 91 |
- Fix version conflicts properly, meaning preserve the version numbers of the form |
| 92 |
`X.Y.0-devZ` (For example: `2.4.0-dev6`). |
| 93 |
- Open a merge request against main. Ensure a merge commit is used, because pre-commit |
| 94 |
needs the patch release tag to be in the main branch history to consider the patch |
| 95 |
release as the latest version, and this won't be the case with rebase or squash. You |
| 96 |
can defend against trigger-happy future selves by enabling auto-merge with the merge |
| 97 |
commit strategy. |
| 98 |
- Wait for approval. Again, use a merge commit. |
| 99 |
- Unblock the main branch. |
| 100 |
- Close the milestone and open a new patch-release milestone. |
| 101 |
|
| 102 |
## Milestone handling |
| 103 |
|
| 104 |
We move issues that were not done to the next milestone and block releases only if there |
| 105 |
are any open issues labelled as `blocker`. |