|
| 1 | +# Development |
| 2 | + |
| 3 | +## Release |
| 4 | + |
| 5 | +### Version |
| 6 | + |
| 7 | +We use [semantic versioning](https://semver.org/), i.e. version labels have the form `v<major>.<minor>.<patch>` |
| 8 | + |
| 9 | +* Patch release: `v1.7.1` to `v1.7.2`, only bug fixes |
| 10 | +* Minor release: `v1.7.1` to `v1.8.0`, bug fixes and new features that **maintain** backwards compatibility. |
| 11 | +* Major release: `v1.7.1` to `v2.0.0`, bug fixes and new features that **break** backwards compatibility. |
| 12 | + |
| 13 | +In the steps below, we'll assume the version to be released is `v1.7.2`. |
| 14 | + |
| 15 | +### Steps |
| 16 | + |
| 17 | +To make a new release of the `aiida-pseudo` plugin package, first create a release branch based on the latest `main` branch: |
| 18 | + |
| 19 | +```console |
| 20 | +git fetch --all --prune |
| 21 | +git checkout origin/main -b release/1.7.2 |
| 22 | +``` |
| 23 | + |
| 24 | +Next, update the source code `__version__` in the `src/aiida_pseudo/__init__.py` file by hand. |
| 25 | +It should look something like this: |
| 26 | + |
| 27 | +``` |
| 28 | +"""AiiDA plugin that simplifies working with pseudo potentials.""" |
| 29 | +__version__ = '1.7.2' |
| 30 | +``` |
| 31 | + |
| 32 | +Then, run the `update_changelog.py` script to update the `CHANGELOG.md` with all the changes made since the last release: |
| 33 | + |
| 34 | +```console |
| 35 | +python .github/workflows/update_changelog.py |
| 36 | +``` |
| 37 | + |
| 38 | +This will automatically add: |
| 39 | + |
| 40 | +1. The header for the new release and the sub-headers in which the commits should be sorted. |
| 41 | +2. The list of commits since the previous release, with links to them. |
| 42 | + |
| 43 | +Sort the commit items into the correct subsection of the change log. |
| 44 | +Ideally, the main changes or new features are also described at the top of the change log message, providing code snippets where it's useful. |
| 45 | + |
| 46 | +Once you've prepared the release branch locally, commit and push it to Github: |
| 47 | + |
| 48 | + git commit -am 'π Release `v1.7.2`' |
| 49 | + git push -u origin release/1.7.2 |
| 50 | + |
| 51 | +Now that the release branch is ready, merge it into `main` via a pull request. |
| 52 | +Make sure the remote `release/1.7.2` branch is up to date by pushing the local changes, then go to Github and create a pull request to the `main` branch of the official repository. |
| 53 | + |
| 54 | +After the pull request has been approved, merge the PR using the "Squash and Merge", and make sure the commit is simply named e.g. "π Release `v1.7.2`". |
| 55 | + |
| 56 | +Once this is complete, fetch all the changes locally, checkout the `main` branch and make sure it's up to date with the remote: |
| 57 | + |
| 58 | + git fetch --all |
| 59 | + git checkout main |
| 60 | + git pull origin |
| 61 | + |
| 62 | +Next, tag the final release commit: |
| 63 | + |
| 64 | + git tag -a v1.7.2 -m 'Release `v1.7.2`' |
| 65 | + |
| 66 | +**IMPORTANT**: once you push the tag to GitHub, a workflow will start that automatically publishes a release on PyPI. |
| 67 | +Double check that the tag is correct, and that the `main` branch looks in good shape. |
| 68 | + |
| 69 | +If you accidentally tagged the wrong commit, you can delete the local tag using the following command: |
| 70 | + |
| 71 | + git tag -d v1.7.2 |
| 72 | + |
| 73 | +Once you're confident that the tag and `main` branch are in good shape, push both to the remote: |
| 74 | + |
| 75 | + git push origin main --tags |
| 76 | + |
| 77 | +With the release tag created, the new release is automatically built and published on PyPI! |
0 commit comments