|
| 1 | +Release process |
| 2 | +=============== |
| 3 | + |
| 4 | +Red's release process involves a bit of work. This document attempts to collect, |
| 5 | +in one place, all the steps needed to make a release of Red. |
| 6 | + |
| 7 | +Types of releases |
| 8 | +----------------- |
| 9 | + |
| 10 | +- Breaking release (``3.x+1.0``) |
| 11 | + |
| 12 | + Release with breaking changes, done from ``V3/develop``. |
| 13 | + |
| 14 | +- Standard release (``3.x.y+1``) |
| 15 | + |
| 16 | + Release without breaking changes that may contain both features and bugfixes. |
| 17 | + |
| 18 | + This is done from ``V3/develop`` or ``3.x`` branch |
| 19 | + if a breaking release is currently in development. |
| 20 | + |
| 21 | +- Maintenance release (``3.x.y+1``) |
| 22 | + |
| 23 | + Release without breaking changes that only contains cherry-picked enhancements and bugfixes. |
| 24 | + |
| 25 | + Quite similar to a standard release but it is done from a short-lived release branch |
| 26 | + using the tag of a previous version as a base. |
| 27 | + |
| 28 | +- Hotfix release (``3.x.y+1``) |
| 29 | + |
| 30 | + Release that is meant to quickly patch one of the currently supported releases |
| 31 | + (usually it is just the latest). |
| 32 | + |
| 33 | + This is done from a short-lived release branch using the tag of a previous version as a base, |
| 34 | + or from ``V3/develop``/``3.x`` if it doesn't contain any meaningful code changes yet. |
| 35 | + |
| 36 | + |
| 37 | +Making a release |
| 38 | +---------------- |
| 39 | + |
| 40 | +As much as possible, the release steps are automated and guided by the **Release Helper** script, |
| 41 | +which is shipped with the repository at ``tools/release_helper.py``. |
| 42 | + |
| 43 | +To use the script, you will need to install the `GitHub CLI <https://cli.github.com>`__ |
| 44 | +and authenticate with your GitHub account using the ``gh auth login`` command. |
| 45 | + |
| 46 | +The script can be started simply by running: |
| 47 | + |
| 48 | +.. prompt:: |
| 49 | + |
| 50 | + .venv/bin/python tools/release_helper.py |
| 51 | + |
| 52 | +which will ask you about the release type you want to make and then guide you through the process. |
| 53 | + |
| 54 | +#. Ensure there are no release blockers. |
| 55 | + |
| 56 | + .. note:: |
| 57 | + |
| 58 | + These will be listed to you by the **Release Helper**. |
| 59 | + |
| 60 | + .. tab:: Hotfix release |
| 61 | + |
| 62 | + You can *generally* skip this. Might still be worth checking |
| 63 | + in case there is some blocker related to release workflow that could potentially affect you. |
| 64 | + |
| 65 | + .. tab:: Everything else |
| 66 | + |
| 67 | + Look at the milestone for the next release and check if there are any Release Blockers |
| 68 | + (labelled as "Release Blocker" on the issue tracker) that need to be handled before the release. |
| 69 | + |
| 70 | +#. Check state of all open pull requests for this milestone. |
| 71 | + |
| 72 | + .. note:: |
| 73 | + |
| 74 | + These will be listed to you by the **Release Helper**. |
| 75 | + |
| 76 | + .. tab:: Hotfix release |
| 77 | + |
| 78 | + This is a hotfix release, you should focus on getting the critical fix out, |
| 79 | + the other PRs should not be important. However, you should still update the milestone |
| 80 | + to make your and others' job easier later. |
| 81 | + |
| 82 | + .. tab:: Everything else |
| 83 | + |
| 84 | + Decide which should be kept for the release, cooperate with another org member(s) on this. |
| 85 | + Move any pull requests not targeted for release to a new milestone with name of the release |
| 86 | + that should come after current one. |
| 87 | + |
| 88 | +#. Review changelog PR. |
| 89 | + |
| 90 | + .. note:: |
| 91 | + |
| 92 | + At this point, you should have an up-to-date milestone containing all PRs |
| 93 | + that are contained in this release. If you're not sure if all PRs are properly assigned, |
| 94 | + you might find **Release Helper**'s ``unreleased`` command (or its |
| 95 | + "Show unreleased commits without a milestone" counter-part from the guided flow) helpful: |
| 96 | + |
| 97 | + .. figure:: /_images/release-helper-changelog-unreleased.png |
| 98 | + :target: /_images/release-helper-changelog-unreleased.png |
| 99 | + |
| 100 | + The changelog PR should always be merged into ``V3/develop``. You should remember to later |
| 101 | + cherry-pick/backport it to a proper branch if you're not making a release from ``V3/develop``. |
| 102 | + |
| 103 | + .. tab:: Hotfix release |
| 104 | + |
| 105 | + Hotfix releases need to contain a changelog. |
| 106 | + |
| 107 | + It can be limited to a short description of what the hotfix release fixes, for example see: |
| 108 | + `Red 3.4.12 changelog <https://docs.discord.red/en/stable/changelog_3_4_0.html#redbot-3-4-12-2021-06-17>`__ |
| 109 | + |
| 110 | + .. tab:: Everything else |
| 111 | + |
| 112 | + - Add (or ask PR author to add) any missing entries based on the release's milestone. |
| 113 | + |
| 114 | + You might find the **Release Helper**'s ``milestone`` command helpful here: |
| 115 | + |
| 116 | + .. figure:: /_images/release-helper-changelog-milestone.png |
| 117 | + :target: /_images/release-helper-changelog-milestone.png |
| 118 | + |
| 119 | + - Update the contributors list in the changelog using contributors list for the milestone |
| 120 | + that you can generate using **Release Helper**'s ``contributors`` command (or its |
| 121 | + "Get contributor list formatted for the changelog" counter-part from the guided flow): |
| 122 | + |
| 123 | + .. figure:: /_images/release-helper-changelog-contributor-list-standalone.png |
| 124 | + :target: /_images/release-helper-changelog-contributor-list-standalone.png |
| 125 | + |
| 126 | + .. figure:: /_images/release-helper-changelog-contributor-list.png |
| 127 | + :target: /_images/release-helper-changelog-contributor-list.png |
| 128 | + |
| 129 | + - Merge the PR once it's ready. |
| 130 | + |
| 131 | +#. Run "Prepare Release" workflow. |
| 132 | + |
| 133 | + .. note:: |
| 134 | + |
| 135 | + This can be triggered automatically with the **Release Helper**. |
| 136 | + The below steps are an alternative way that doesn't require the use of that tool. |
| 137 | + |
| 138 | + Go to https://github.com/Cog-Creators/Red-DiscordBot/actions/workflows/prepare_release.yml |
| 139 | + |
| 140 | + .. tip:: |
| 141 | + |
| 142 | + This step only takes care of automatically creating some PRs, |
| 143 | + it won't release anything, don't worry! |
| 144 | + |
| 145 | + - Click on the "Run workflow" button |
| 146 | + - Choose the long-lived branch for the version you're releasing |
| 147 | + |
| 148 | + This is either ``V3/develop`` or ``3.x`` branch that you will be cherry-picking changes from, |
| 149 | + not the short-lived release branch. |
| 150 | + |
| 151 | + - Click on the "Run workflow" button in the popover |
| 152 | + |
| 153 | + .. figure:: /_images/prepare-release-workflow.png |
| 154 | + :target: /_images/prepare-release-workflow.png |
| 155 | + |
| 156 | +#. Merge the automatically created PRs. |
| 157 | + |
| 158 | + .. note:: |
| 159 | + |
| 160 | + These will be listed to you by the **Release Helper**. |
| 161 | + |
| 162 | + Wait for "Prepare Release" workflow to finish and merge the PRs that it created. |
| 163 | + |
| 164 | +#. Create a short-lived release branch. |
| 165 | + |
| 166 | + .. note:: |
| 167 | + |
| 168 | + This is a manual step - the **Release Helper** will pause at this step |
| 169 | + for you to perform the necessary actions. |
| 170 | + |
| 171 | + .. tab:: Hotfix release |
| 172 | + |
| 173 | + .. note:: |
| 174 | + |
| 175 | + This does not apply if you're releasing from the long-lived branch |
| 176 | + (i.e. ``V3/develop`` or ``3.x``). |
| 177 | + |
| 178 | + - Create a branch named ``V3/release/VERSION_TO_RELEASE_HERE`` based off |
| 179 | + a tag of previous version. |
| 180 | + |
| 181 | + This can be done with the command: |
| 182 | + |
| 183 | + .. prompt:: |
| 184 | + |
| 185 | + git checkout -b V3/release/VERSION_TO_RELEASE_HERE PREVIOUS_VERSION |
| 186 | + |
| 187 | + - Cherry-pick the critical fix, the changelog, the automated PRs, and the version bump. |
| 188 | + - Push the branch to upstream repository (Cog-Creators/Red-DiscordBot) |
| 189 | + |
| 190 | + With a typical setup where ``upstream`` remote points to upstream repository |
| 191 | + and ``origin`` points to user's fork, this can be done with the command: |
| 192 | + |
| 193 | + .. prompt:: |
| 194 | + |
| 195 | + git push -u upstream V3/release/VERSION_TO_RELEASE_HERE |
| 196 | + |
| 197 | + .. tab:: Maintenance release |
| 198 | + |
| 199 | + - Create a branch named ``V3/release/VERSION_TO_RELEASE_HERE`` based off |
| 200 | + a tag of previous version. |
| 201 | + |
| 202 | + This can be done with the command: |
| 203 | + |
| 204 | + .. prompt:: |
| 205 | + |
| 206 | + git checkout -b V3/release/VERSION_TO_RELEASE_HERE PREVIOUS_VERSION |
| 207 | + |
| 208 | + - Cherry-pick the relevant changes, the changelog, the automated PRs, and the version bump. |
| 209 | + - Push the branch to upstream repository (Cog-Creators/Red-DiscordBot) |
| 210 | + |
| 211 | + With a typical setup where ``upstream`` remote points to upstream repository |
| 212 | + and ``origin`` points to user's fork, this can be done with the command: |
| 213 | + |
| 214 | + .. prompt:: |
| 215 | + |
| 216 | + git push -u upstream V3/release/VERSION_TO_RELEASE_HERE |
| 217 | + |
| 218 | + .. tab:: Breaking or standard release |
| 219 | + |
| 220 | + This does not apply. |
| 221 | + |
| 222 | + .. _write-announcement: |
| 223 | + |
| 224 | +#. Write (not send!) an announcement for the new release. |
| 225 | + |
| 226 | + .. note:: |
| 227 | + |
| 228 | + This and the following steps are not performed by the **Release Helper**. |
| 229 | + |
| 230 | + This is the announcement that you will later `post to Discord <publish-announcement>`. |
| 231 | + |
| 232 | + Remember to: |
| 233 | + |
| 234 | + - Mention that the changelog contains "Read before updating" section (if applicable): |
| 235 | + |
| 236 | + .. code:: markdown |
| 237 | +
|
| 238 | + __**Before you update**: please ensure that you read the “Read before updating” section in the changelogs first.__ |
| 239 | +
|
| 240 | + - Include the link to changelog. |
| 241 | + |
| 242 | + .. note:: |
| 243 | + |
| 244 | + - Use link to ``stable`` or tagged (i.e. ``3.4.0``) version of docs, |
| 245 | + DO NOT USE link to ``latest``. |
| 246 | + - The changelog link should point to the section for the specific release |
| 247 | + (the part after ``#`` in the URL) |
| 248 | + |
| 249 | + For example: |
| 250 | + |
| 251 | + .. code:: markdown |
| 252 | +
|
| 253 | + Full changelogs here: <https://docs.discord.red/en/stable/changelog_3_4_0.html#redbot-3-4-12-2021-06-17> |
| 254 | +
|
| 255 | +#. Make a new release through `GitHub Releases <https://github.com/Cog-Creators/Red-DiscordBot/releases/new>`__. |
| 256 | + |
| 257 | + .. attention:: |
| 258 | + |
| 259 | + Remember to change the target branch when you're not releasing from ``V3/develop``! |
| 260 | + |
| 261 | + - Put the version number as tag name (i.e. ``3.4.0``) |
| 262 | + - Put the version number prepended with "v" as release title (i.e. ``v3.4.0``) |
| 263 | + - Ensure that the target branch is selected correctly |
| 264 | + - Write a short release description |
| 265 | + |
| 266 | + The description can be informal, the changelog has all the important information already. |
| 267 | + Be sure to put a link to full changelog from our docs in release description. |
| 268 | + |
| 269 | + The changelog link should point to the section for the specific release |
| 270 | + (the part after ``#`` in the URL), e.g.: |
| 271 | + |
| 272 | + .. code:: markdown |
| 273 | +
|
| 274 | + Full changelog: https://docs.discord.red/en/latest/changelog_3_4_0.html#redbot-3-4-12-2021-06-17 |
| 275 | +
|
| 276 | + .. figure:: /_images/drafting-new-release.png |
| 277 | + :target: /_images/drafting-new-release.png |
| 278 | + |
| 279 | +#. Check the correctness of Release information and approve or reject the environment run. |
| 280 | + |
| 281 | + .. danger:: |
| 282 | + |
| 283 | + This is the step when the new version will get published. |
| 284 | + |
| 285 | + At this point you should already have `written the announcement <write-announcement>` |
| 286 | + that you will be sending after this is done. |
| 287 | + |
| 288 | + Go to https://github.com/Cog-Creators/Red-DiscordBot/actions/workflows/publish_release.yml |
| 289 | + |
| 290 | + - Click on the first workflow run (with a clock icon) on the list. |
| 291 | + |
| 292 | + .. figure:: /_images/publish-release-workflow-list.png |
| 293 | + :target: /_images/publish-release-workflow-list.png |
| 294 | + |
| 295 | + - Click on the "GO HERE BEFORE APPROVING" job. |
| 296 | + - Expand the "REVIEW OUTPUT OF THIS STEP BEFORE APPROVING" step. |
| 297 | + - **Verify the release information printed in the step is correct.** |
| 298 | + |
| 299 | + .. figure:: /_images/publish-release-job.png |
| 300 | + :target: /_images/publish-release-job.png |
| 301 | + |
| 302 | + - Go back to Summary, click on "Review deployments" and approve or reject the environment run. |
| 303 | + |
| 304 | +#. Wait for the CI to finish its job. |
| 305 | + |
| 306 | + "Publish Release" workflow needs to finish before you can continue. |
| 307 | + You should also wait for the ``stable`` build on the Read The Docs to finish if it hasn't already. |
| 308 | + |
| 309 | + .. _publish-announcement: |
| 310 | + |
| 311 | +#. Send and publish an announcement in Discord. |
| 312 | + |
| 313 | + This is the announcement that you wrote in `the earlier step <write-announcement>`. |
| 314 | + |
| 315 | +#. Merge the PR bumping to dev version. |
| 316 | + |
| 317 | + It should have been automatically created during "Publish release" workflow |
| 318 | + that you approved earlier. |
| 319 | + |
| 320 | +#. Close release milestone and create a new one. |
| 321 | + |
| 322 | + Close the milestone for the release that was just made |
| 323 | + and create an appropriately named milestone for the next release. |
| 324 | + |
| 325 | +After all this is done, you can enjoy the new release |
| 326 | +(or make a hotfix if there's a critical issue, let's hope there's not though :)) |
0 commit comments