|
| 1 | +========================== |
| 2 | +Maintainers' documentation |
| 3 | +========================== |
| 4 | + |
| 5 | +How to release |
| 6 | +============== |
| 7 | + |
| 8 | +The contents of this section is a detailed version of the "release" part of the :file:`.github/PULL_REQUEST_TEMPLATE.md` file. |
| 9 | + |
| 10 | +Requirements |
| 11 | +------------ |
| 12 | + |
| 13 | +You can use a dedicated virtualenv, or install the following in your userspace, but these should be available in your ``$PATH``: |
| 14 | + |
| 15 | +* Python3 (any version) |
| 16 | +* `twine <https://pypi.org/project/twine/>`_ |
| 17 | + |
| 18 | +Pre-release |
| 19 | +----------- |
| 20 | + |
| 21 | +* Create a branch with an adequate name, such as ``release/x.y.z``. |
| 22 | +* Edit the :file:`formidable/__init__.py` source file and change the value of ``formidable.version`` to the appropriate version number. |
| 23 | +* Amend the :file:`CHANGELOG.rst` file to reflect your change. Put there the version number, the date, and do not hesitate to re-arrange its content if needed (e.g.: put sub-sections in the release notes). |
| 24 | +* *If the version deprecates one or more feature(s)* check the docs :file:`deprecations.rst` file and change it if necessary. |
| 25 | +* Check if you have to edit other files and change them accordingly (e.g.: README). |
| 26 | + |
| 27 | +Commit |
| 28 | +++++++ |
| 29 | + |
| 30 | +Once your content is ready, **commit it**: |
| 31 | + |
| 32 | +.. code:: |
| 33 | +
|
| 34 | + git commit -am "Release x.y.z" |
| 35 | +
|
| 36 | +If you want, you can also make a more detailed commit message, by copying/pasting the contents of the Changelog. |
| 37 | + |
| 38 | +Push |
| 39 | +++++ |
| 40 | + |
| 41 | +**Push your branch** on Github and wait for the CI to return green. |
| 42 | + |
| 43 | +You can also start to **create your Pull-Request** at this point, and check if you are at the correct step in the "Release" checklist. |
| 44 | + |
| 45 | +.. attention:: When to tag? |
| 46 | + |
| 47 | + If you are very confident, you can tag here. But we'd recommend to wait to be sure that you have everything sorted out. |
| 48 | + |
| 49 | +Back to development |
| 50 | ++++++++++++++++++++ |
| 51 | + |
| 52 | +* Edit the :file:`CHANGELOG.rst` file to add a "master (unreleased)" section, with a dummy log item, such as "Nothing to see here yet". |
| 53 | +* Edit the :file:`formidable/__init__.py` source file and put a non-release version number, such as ``x.y+1.0.dev0``. |
| 54 | +* Commit this change with, for example, the following command: ``git commit -a -m "Back to dev => x.y+1.0.dev0"`` |
| 55 | + |
| 56 | +Again, push the branch and wait for the tests to be green. |
| 57 | + |
| 58 | +**At this point, the pull-request should be ready for review**. |
| 59 | + |
| 60 | +Release |
| 61 | +------- |
| 62 | + |
| 63 | +If the CI has returned a successful result, and your peers have reviewed your PR, you're ready to proceed with the release. |
| 64 | + |
| 65 | +Tag the right commit |
| 66 | +++++++++++++++++++++ |
| 67 | + |
| 68 | +You should have two commits in your log corresponding to your latest changes: |
| 69 | + |
| 70 | +.. code:: shell |
| 71 | +
|
| 72 | + $ git log --pretty=format:'%h %ad | %s' --date=short -n 2 |
| 73 | + 8fd30ec 2021-04-29 | Back to dev => x.y+1.0.dev0 |
| 74 | + 5b65073 2021-04-29 | Release x.y.0 |
| 75 | +
|
| 76 | +Checkout to the "Release" commit and tag it. |
| 77 | + |
| 78 | +.. code:: shell |
| 79 | +
|
| 80 | + $ git checkout 5b65073 |
| 81 | + $ git tag x.y.0 |
| 82 | +
|
| 83 | +This tag can be pushed to Github with: |
| 84 | + |
| 85 | +.. code:: shell |
| 86 | +
|
| 87 | + $ git push --tags |
| 88 | +
|
| 89 | +Generate files |
| 90 | +++++++++++++++ |
| 91 | + |
| 92 | +Now you can generate the files using the following command at the root of the project: |
| 93 | + |
| 94 | +.. code:: shell |
| 95 | +
|
| 96 | + $ python3 setup.py sdist bdist_wheel |
| 97 | +
|
| 98 | +This should produce two files: |
| 99 | + |
| 100 | +* :file:`dist/django-formidable-x.y.0.tar.gz` |
| 101 | +* :file:`dist/django_formidable-x.y.0-py3-none-any.whl` |
| 102 | + |
| 103 | +Merge the Pull Request |
| 104 | +++++++++++++++++++++++ |
| 105 | + |
| 106 | +Merge from Github, or, if you dislike merge commits, type the following commands from your local copy: |
| 107 | + |
| 108 | +.. code:: shell |
| 109 | +
|
| 110 | + $ git checkout master |
| 111 | + $ git merge --ff release/x.y.z |
| 112 | + $ git push |
| 113 | +
|
| 114 | +Upload to PyPI |
| 115 | +++++++++++++++ |
| 116 | + |
| 117 | +In order to upload to PyPI, you should have an account and have at least the *maintainer* or *owner* role for this project **and** have your :file:`.pypirc` correctly configured to upload files (i.e. have the pypi repository as default and correct credentials, using your password or a project token). |
| 118 | + |
| 119 | +Using ``twine`` you may now upload the two files previously generated: |
| 120 | + |
| 121 | +.. code:: shell |
| 122 | +
|
| 123 | + twine upload dist/django-formidable-x.y.0.tar.gz dist/django_formidable-x.y.0-py3-none-any.whl |
| 124 | +
|
| 125 | +You can then go to https://pypi.org/project/django-formidable/ to check the latest version. |
| 126 | + |
| 127 | +.. hint:: |
| 128 | + |
| 129 | + Due to asynchronous tasks and cache invalidation, the latest version may not appear immediately. Be patient. |
| 130 | + |
| 131 | +Post-release |
| 132 | +------------ |
| 133 | + |
| 134 | +There are a few cleanup tasks, such as: |
| 135 | + |
| 136 | +* Delete the release branch, |
| 137 | +* Edit the Release page on Github to reflect the changelog, |
| 138 | +* Eventually make some feedback on the issues impacted by the new release, |
| 139 | +* Enjoy & celebrate! |
0 commit comments