2017-09-08 04:48:34 +08:00
2020-03-02 01:46:35 +08:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~
We have developed an automated workflow for releases, that uses GitHub workflows and is triggered
2021-06-28 18:24:48 +08:00
by `manually running <https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow> `__
the `prepare-release-pr workflow <https://github.com/pytest-dev/pytest/actions/workflows/prepare-release-pr.yml> `__
on GitHub Actions.
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
The automation will decide the new version number based on the following criteria:
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
- If the "major release" input is set to "yes", release a new major release
(e.g. 7.0.0 -> 8.0.0)
- If there are any `` .feature.rst `` or `` .breaking.rst `` files in the
`` changelog `` directory, release a new minor release (e.g. 7.0.0 -> 7.1.0)
- Otherwise, release a bugfix release (e.g. 7.0.0 -> 7.0.1)
- If the "prerelease" input is set, append the string to the version number
(e.g. 7.0.0 -> 8.0.0rc1), if "major" is set, and "prerelease" is set to `rc1` )
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
Bug-fix and minor releases
^^^^^^^^^^^^^^^^^^^^^^^^^^
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
Bug-fix and minor releases are always done from a maintenance branch. First,
consider double-checking the `` changelog `` directory to see if there are any
breaking changes or new features.
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
For a new minor release, first create a new maintenance branch from `` main `` ::
2020-08-02 00:46:35 +08:00
2022-02-04 19:13:33 +08:00
git fetch upstream
2021-06-28 18:24:48 +08:00
git branch 7.1.x upstream/main
git push upstream 7.1.x
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
Then, trigger the workflow with the following inputs:
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
- branch: **7.1.x**
- major release: **no**
- prerelease: empty
2020-03-02 01:46:35 +08:00
2021-06-28 18:24:48 +08:00
Or via the commandline using `GitHub's cli <https://github.com/cli/cli> `__ ::
2020-03-02 01:46:35 +08:00
2021-06-28 18:24:48 +08:00
gh workflow run prepare-release-pr.yml -f branch=7.1.x -f major=no -f prerelease=
2020-03-02 01:46:35 +08:00
2021-06-28 18:24:48 +08:00
Where `` 7.1.x `` is the maintenance branch for the `` 7.1 `` series. The automated
workflow will publish a PR for a branch `` release-7.1.0 `` .
2020-03-02 01:46:35 +08:00
2021-06-28 18:24:48 +08:00
Similarly, for a bug-fix release, use the existing maintenance branch and
trigger the workflow with e.g. `` branch: 7.0.x `` to get a new `` release-7.0.1 ``
PR.
Major releases
^^^^^^^^^^^^^^
2020-07-28 19:40:14 +08:00
2021-03-19 05:13:12 +08:00
1. Create a new maintenance branch from `` main `` ::
2020-07-28 19:40:14 +08:00
2022-02-04 19:13:33 +08:00
git fetch upstream
2021-06-28 18:24:48 +08:00
git branch 8.0.x upstream/main
git push upstream 8.0.x
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
2. Trigger the workflow with the following inputs:
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
- branch: **8.0.x**
- major release: **yes**
- prerelease: empty
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
Or via the commandline::
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
gh workflow run prepare-release-pr.yml -f branch=8.0.x -f major=yes -f prerelease=
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
The automated workflow will publish a PR for a branch `` release-8.0.0 `` .
2020-08-02 00:46:35 +08:00
At this point on, this follows the same workflow as other maintenance branches: bug-fixes are merged
2021-03-19 05:13:12 +08:00
into `` main `` and ported back to the maintenance branch, even for release candidates.
2020-08-02 00:46:35 +08:00
2021-06-28 18:24:48 +08:00
Release candidates
^^^^^^^^^^^^^^^^^^
To release a release candidate, set the "prerelease" input to the version number
suffix to use. To release a `` 8.0.0rc1 `` , proceed like under "major releases", but set:
- branch: 8.0.x
- major release: yes
- prerelease: **rc1**
Or via the commandline::
gh workflow run prepare-release-pr.yml -f branch=8.0.x -f major=yes -f prerelease=rc1
The automated workflow will publish a PR for a branch `` release-8.0.0rc1 `` .
2020-08-02 00:46:35 +08:00
**A note about release candidates**
During release candidates we can merge small improvements into
the maintenance branch before releasing the final major version, however we must take care
to avoid introducing big changes at this stage.
2020-03-02 01:46:35 +08:00
Preparing: Manual Method
~~~~~~~~~~~~~~~~~~~~~~~~
2020-08-02 00:46:35 +08:00
**Important** : pytest releases must be prepared on **Linux** because the docs and examples expect
to be executed on that platform.
2016-02-14 03:29:30 +08:00
2020-01-25 22:31:21 +08:00
To release a version `` MAJOR.MINOR.PATCH `` , follow these steps:
2015-11-19 00:55:18 +08:00
2020-08-02 00:46:35 +08:00
#. For major and minor releases, create a new branch `` MAJOR.MINOR.x `` from
2021-03-19 05:13:12 +08:00
`` upstream/main `` and push it to `` upstream `` .
2019-06-03 01:06:41 +08:00
2020-01-25 22:31:21 +08:00
#. Create a branch `` release-MAJOR.MINOR.PATCH `` from the `` MAJOR.MINOR.x `` branch.
2014-09-05 19:13:23 +08:00
2020-01-25 22:31:21 +08:00
Ensure your are updated and in a clean working tree.
2017-05-31 08:26:41 +08:00
2018-07-14 21:21:31 +08:00
#. Using `` tox `` , generate docs, changelog, announcements::
2018-07-04 09:15:11 +08:00
2020-01-25 22:31:21 +08:00
$ tox -e release -- MAJOR.MINOR.PATCH
2016-08-20 05:50:46 +08:00
2018-07-14 21:21:31 +08:00
This will generate a commit with all the changes ready for pushing.
2017-05-31 08:26:41 +08:00
2020-01-25 22:31:21 +08:00
#. Open a PR for the `` release-MAJOR.MINOR.PATCH `` branch targeting `` MAJOR.MINOR.x `` .
2017-05-31 08:26:41 +08:00
2020-03-02 01:46:35 +08:00
Releasing
~~~~~~~~~
Both automatic and manual processes described above follow the same steps from this point onward.
2023-09-02 19:13:00 +08:00
#. After all tests pass and the PR has been approved, trigger the `` deploy `` job
2023-09-08 18:22:16 +08:00
in https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml, using the `` release-MAJOR.MINOR.PATCH `` branch
as source.
2015-07-26 21:20:32 +08:00
2023-09-02 19:13:00 +08:00
This job will require approval from `` pytest-dev/core `` , after which it will publish to PyPI
and tag the repository.
2014-09-05 19:13:23 +08:00
2022-02-10 15:58:20 +08:00
#. Merge the PR. **Make sure it's not squash-merged** , so that the tagged commit ends up in the main branch.
2019-06-03 01:06:41 +08:00
2021-03-19 05:13:12 +08:00
#. Cherry-pick the CHANGELOG / announce files to the `` main `` branch::
2019-06-03 01:06:41 +08:00
2022-02-04 19:13:33 +08:00
git fetch upstream
2021-05-05 00:25:11 +08:00
git checkout upstream/main -b cherry-pick-release
2020-08-02 00:46:35 +08:00
git cherry-pick -x -m1 upstream/MAJOR.MINOR.x
2020-07-29 22:29:24 +08:00
#. Open a PR for `` cherry-pick-release `` and merge it once CI passes. No need to wait for approvals if there were no conflicts on the previous step.
2018-08-30 05:13:08 +08:00
2021-12-07 21:04:27 +08:00
#. For major and minor releases (or the first prerelease of it), tag the release cherry-pick merge commit in main with
2020-10-18 00:08:48 +08:00
a dev tag for the next feature release::
2021-03-19 05:13:12 +08:00
git checkout main
2020-10-18 00:08:48 +08:00
git pull
git tag MAJOR.{MINOR+1}.0.dev0
2022-02-04 19:13:33 +08:00
git push upstream MAJOR.{MINOR+1}.0.dev0
2020-10-18 00:08:48 +08:00
2022-02-05 00:36:31 +08:00
#. For major and minor releases, change the default version in the `Read the Docs Settings <https://readthedocs.org/dashboard/pytest/advanced/> `_ to the new branch.
2018-02-10 06:59:15 +08:00
#. Send an email announcement with the contents from::
2014-09-05 19:13:23 +08:00
2018-02-10 06:59:15 +08:00
doc/en/announce/release-<VERSION>.rst
2014-09-05 19:13:23 +08:00
2018-02-10 06:59:15 +08:00
To the following mailing lists:
2017-05-31 08:26:41 +08:00
2018-02-10 06:59:15 +08:00
* pytest-dev@python.org (all releases)
* python-announce-list@python.org (all releases)
* testing-in-python@lists.idyll.org (only major/minor releases)
2015-07-26 21:20:32 +08:00
2018-02-10 06:59:15 +08:00
And announce it on `Twitter <https://twitter.com/> `_ with the `` #pytest `` hashtag.