Debian Codegraph @

docs/software_dev/hotfix.rst

raw
1 .. _hotfix:
2
3 Hotfix Workflow
4 ===============
5
6 This section will describe how to create a hotfix to a previous release.
7
8 Determine Version Number
9 ------------------------
10
11 The first thing you must do before creating a hotfix to a previous release is determine the new (`semantic <https://semver.org/>`_) version number.
12
13 In this example, we'll be using ``v3.2.1``. That's
14
15 * a ``MAJOR`` version ``3``,
16 * a ``MINOR`` version ``2``, and
17 * a ``PATCH`` version ``1``
18
19 For this workflow, we assume that the previous release that we need to patch was ``v3.2.0``, and we'll be creating a hotfix ``v3.2.1``. The ``PATCH`` version must always be one higher than the previous release that we're patching.
20
21 ::
22
23 v 3 . 2 . 1 ⭠ PATCH
24 MAJOR ⮥ ⮤ MINOR
25
26 Create Hotfix Branch
27 ---------------------
28
29 In our project, we only put production-ready stable code in the ``master`` branch. No commits should occur in ``master``.
30
31 The ``dev`` branch and feature-specific branches are branched-off from the ``dev`` branch or ``master`` directly.
32
33 Since your hotfix applies to an old release and there may have since been changes to ``dev`` or ``master`` that we don't want to backport just for the hotfix, we should create a hotfix-specific branch from the previous release branch.
34
35 ::
36
37 user@host:~/buskill-app$ git checkout -b v3.2.1 refs/heads/v3.2.0
38 Switched to a new branch 'v3.2.1'
39 userhost:~/buskill-app$
40
41 user@host:~/buskill-app$ git push origin v3.2.1
42 Total 0 (delta 0), reused 0 (delta 0)
43 remote:
44 remote: Create a pull request for 'v3.2.1' on GitHub by visiting:
45 remote: https://github.com/BusKill/buskill-app/pull/new/v3.2.0
46 remote:
47 To github.com:BusKill/buskill-app.git
48 * [new branch] v3.2.1 -> v3.2.1
49 user@host:~/buskill-app$
50
51 Finalize Release
52 ----------------
53
54 After applying your patch to the new ``v3.2.1`` branch, make sure to also
55
56 #. Update CHANGELOG
57 #. Test
58 #. Update documentation
59
60 Then commit the changes and push to github. Do *not* merge the hotfix branch with any other branch.
61
62 ::
63
64 user@host:~/buskill-app/$ vim CHANGELOG
65 user@host:~/buskill-app/$ git commit -am 'updated changelog for new release'
66 user@host:~/buskill-app/$ git push
67 ...
68
69 Tag
70 ---
71
72 Create a tag for the new hotfix release, and push that to github.com
73
74 ::
75
76 user@host:~/buskill-app$ git branch -l
77 dev
78 master
79 v3.2.0
80 * v3.2.1
81 user@host:~/buskill-app$
82
83 user@host:~/buskill-app$ git tag v3.2.1
84
85 user@host:~/buskill-app$ git push origin refs/tags/v3.2.1
86 Total 0 (delta 0), reused 0 (delta 0)
87 To github.com:BusKill/buskill-app.git
88 * [new tag] v3.2.1 -> v3.2.1
89 user@host:~/buskill-app$
90
91 Build, Sign, and Upload
92 -----------------------
93
94 To build, sign, and upload the hotfix release, follow the same steps in the :ref:`Release Workflow <release_build>` documentation.
95
96 .. _reproducible: https://github.com/BusKill/buskill-app/issues/3