|
| 1 | +# Release instructions |
| 2 | + |
| 3 | +Before creating a new release please do a careful consideration about the |
| 4 | +version number for the new release. We are following [Semantic Versioning](https://semver.org/) |
| 5 | +and [PEP440](https://www.python.org/dev/peps/pep-0440/). |
| 6 | + |
| 7 | +* Install development dependencies |
| 8 | + |
| 9 | + ```sh |
| 10 | + pipenv install --dev |
| 11 | + ``` |
| 12 | + |
| 13 | +* Fetch upstream changes and create release branch |
| 14 | + |
| 15 | + ```sh |
| 16 | + git fetch upstream |
| 17 | + git checkout -b create-new-release upstream/master |
| 18 | + ``` |
| 19 | + |
| 20 | +* Open [setup.py](setup.py) |
| 21 | + and increment the version number. |
| 22 | + |
| 23 | +* Update [CHANGELOG](CHANGELOG.md) |
| 24 | + |
| 25 | +* Create a distribution files |
| 26 | + |
| 27 | + ```sh |
| 28 | + rm -rf dist build autohooks_plugin_black.egg-info |
| 29 | + python3 setup.py sdist bdist_wheel |
| 30 | + ``` |
| 31 | + |
| 32 | +* Create a git commit |
| 33 | + |
| 34 | + ```sh |
| 35 | + git add . |
| 36 | + git commit -m "Prepare release <version>" |
| 37 | + ``` |
| 38 | + |
| 39 | +* Create a pypirc file |
| 40 | + |
| 41 | + ```sh |
| 42 | + vim ~/.pypirc |
| 43 | + ``` |
| 44 | + |
| 45 | + with the following content (Note: `<username>` must be replaced) |
| 46 | + |
| 47 | + ```ini |
| 48 | + [distutils] |
| 49 | + index-servers = |
| 50 | + pypi |
| 51 | + testpypi |
| 52 | + |
| 53 | + [pypi] |
| 54 | + username = <username> |
| 55 | + |
| 56 | + [testpypi] |
| 57 | + repository = https://test.pypi.org/legacy/ |
| 58 | + username = <username> |
| 59 | + ``` |
| 60 | + |
| 61 | +* Create an account at [Test PyPI](https://packaging.python.org/guides/using-testpypi/) |
| 62 | + |
| 63 | +* Upload the archives in dist to [Test PyPI](https://test.pypi.org/) |
| 64 | + |
| 65 | + ```sh |
| 66 | + twine upload -r testpypi dist/* |
| 67 | + ``` |
| 68 | + |
| 69 | +* Check if the package is available at https://test.pypi.org/project/autohooks-plugin-black |
| 70 | + |
| 71 | +* Create a test directory |
| 72 | + |
| 73 | + ```sh |
| 74 | + mkdir autohooks-install-test |
| 75 | + cd autohooks-install-test |
| 76 | + pipenv run pip install --pre -I --extra-index-url https://test.pypi.org/simple/ autohooks-plugin-black |
| 77 | + ``` |
| 78 | + |
| 79 | +* Remove test environment |
| 80 | + |
| 81 | + ```sh |
| 82 | + pipenv --rm |
| 83 | + cd .. |
| 84 | + rm -rf autohooks-install-test |
| 85 | + ``` |
| 86 | + |
| 87 | +* Create a release PR |
| 88 | + |
| 89 | + ```sh |
| 90 | + git push origin |
| 91 | + ``` |
| 92 | + Open GitHub and create a PR against https://github.com/greenbone/autohooks-plugin-black |
| 93 | + |
| 94 | +* Update after PR is merged |
| 95 | + |
| 96 | + ```sh |
| 97 | + git fetch upstream |
| 98 | + git rebase upstream/master |
| 99 | + ``` |
| 100 | +* Create a git tag |
| 101 | + |
| 102 | + ```sh |
| 103 | + git tag v<version> |
| 104 | + ``` |
| 105 | + |
| 106 | + or even signed with your gpg key |
| 107 | + |
| 108 | + ```sh |
| 109 | + git tag -s v<version> |
| 110 | + ``` |
| 111 | +* Create final distribution files |
| 112 | + |
| 113 | + ```sh |
| 114 | + rm -rf dist build autohooks_plugin_black.egg-info |
| 115 | + python3 setup.py sdist bdist_wheel |
| 116 | + ``` |
| 117 | + |
| 118 | +* Create an account at [PyPI](https://pypi.org/) if not exist already |
| 119 | + |
| 120 | +* Upload to real [PyPI](https://pypi.org/) |
| 121 | + |
| 122 | + ```sh |
| 123 | + twine upload dist/* |
| 124 | + ``` |
| 125 | + |
| 126 | +* Check if new version is available at https://pypi.org/project/autohooks-plugin-black |
| 127 | + |
| 128 | +* Update version in [setup.py](setup.py) |
| 129 | + |
| 130 | + Use a alpha version like `(1, 1, 1, 'alpha')` or |
| 131 | + `(1, 1, 1, 'alpha', 0)` |
| 132 | + |
| 133 | +* Create a commit |
| 134 | + |
| 135 | + ```sh |
| 136 | + git commit -m "Update version after <version> release" |
| 137 | + ``` |
| 138 | + |
| 139 | +* Push changes and tag to GitHub |
| 140 | + |
| 141 | + ```sh |
| 142 | + git push --tags upstream master |
| 143 | + ``` |
0 commit comments