| 1 | # Distribution |
| 2 | |
| 3 | This section describes how to build and deploy publicly available releases of |
| 4 | the Step CLI. |
| 5 | |
| 6 | ## Creating A New Release |
| 7 | |
| 8 | New releases are (almost) entirely built and deployed by Travis-CI. Creating a new |
| 9 | release is as simple as pushing a new github tag. |
| 10 | |
| 11 | **Definitions**: |
| 12 | |
| 13 | * **Standard Release**: ready for public use. no `-rc*` suffix on the version. |
| 14 | e.g. `v1.0.2` |
| 15 | * **Release Candidate**: not ready for public use, still testing. must have a |
| 16 | `-rc*` suffix. e.g. `v1.0.2-rc` or `v1.0.2-rc.4` |
| 17 | |
| 18 | 1. **Update smallstep/certificates.** |
| 19 | |
| 20 | ``` |
| 21 | $ go get -u github.com/smallstep/certificates |
| 22 | ``` |
| 23 | |
| 24 | 1. **Commit all changes.** |
| 25 | |
| 26 | Make sure that the local checkout is up to date with the remote origin and |
| 27 | that all local changes have been pushed. |
| 28 | |
| 29 | ``` |
| 30 | $ git pull --rebase origin master |
| 31 | $ git push |
| 32 | ``` |
| 33 | |
| 34 | 2. **Select the value of the next tag, but DON'T tag it!** |
| 35 | |
| 36 | 1. **Find the most recent tag.** |
| 37 | |
| 38 | ``` |
| 39 | $ git fetch --tags |
| 40 | $ git tag |
| 41 | ``` |
| 42 | |
| 43 | The new tag needs to be the logical successor of the most recent existing tag. |
| 44 | See [versioning](#versioning) section for more information on version numbers. |
| 45 | |
| 46 | 2. **Select the type and value of the next tag.** |
| 47 | |
| 48 | Is the new release a *release candidate* or a *standard release*? |
| 49 | |
| 50 | 1. Release Candidate |
| 51 | |
| 52 | If the most recent tag is a standard release, say `v1.0.2`, then the version |
| 53 | of the next release candidate should be `v1.0.3-rc.1`. If the most recent tag |
| 54 | is a release candidate, say `v1.0.2-rc.3`, then the version of the next |
| 55 | release candidate should be `v1.0.2-rc.4`. |
| 56 | |
| 57 | 2. Standard Release |
| 58 | |
| 59 | If the most recent tag is a standard release, say `v1.0.2`, then the version |
| 60 | of the next standard release should be `v1.0.3`. If the most recent tag |
| 61 | is a release candidate, say `v1.0.2-rc.3`, then the version of the next |
| 62 | standard release should be `v1.0.3`. |
| 63 | |
| 64 | 3. **Synchronize the versions of `cli` and `certificates`.** |
| 65 | |
| 66 | > **NOTE**: If you do not need to update the version of `certificates` required |
| 67 | > by the `cli` at this time (and vice versa) then thank your lucky stars and |
| 68 | > move on to step 5. |
| 69 | |
| 70 | Buckle up and get your affairs in order because here be dragons. |
| 71 | |
| 72 | > NOTE: In the subsequent steps let A.B.C be the new tag for the `cli` repo |
| 73 | > and X.Y.Z be the new tag for the `certificates` repo. |
| 74 | |
| 75 | 1. Complete steps 1 & 2 from the [`certificates` distribution doc][1]. |
| 76 | |
| 77 | Up to the part where a tag has been selected, but not applied. |
| 78 | |
| 79 | 2. Bump the version of `cli` in the [`certificates` go.mod][2] to `vA.B.C`. |
| 80 | |
| 81 | 3. Commit the change to go.mod. And push the tag. |
| 82 | |
| 83 | ``` |
| 84 | $ git add go.mod; git commit -m "Bump version of cli to vA.B.C" |
| 85 | $ git tag vX.Y.Z; git tag push |
| 86 | ``` |
| 87 | |
| 88 | This pushed tag will break in Travis because `[email protected]` does not exist. |
| 89 | That's okay. |
| 90 | |
| 91 | 4. Bump the version of `certificates` in the [`cli` go.mod][3] to `vX.Y.Z`. |
| 92 | |
| 93 | 5. Commit the change to go.mod. And push the tag. |
| 94 | |
| 95 | ``` |
| 96 | $ git add go.mod; git commit -m "Bump version of cli to vX.Y.Z" |
| 97 | $ git tag vA.B.C; git tag push |
| 98 | ``` |
| 99 | |
| 100 | This tagged build will break in CI/CD because sum.golang.org has not |
| 101 | yet had the chance to crawl and create an entry for the new tag. |
| 102 | |
| 103 | 6. Wait for `https://sum.golang.org/lookup/github.com/smallstep/[email protected]` |
| 104 | to become available. |
| 105 | |
| 106 | Keep looking it up in the browser or `curl`ing it from the command line |
| 107 | until it becomes available. ~10 - 20 mins. |
| 108 | |
| 109 | 7. In [Travis][4] restart the failed, tagged build for `cli` through the UI. |
| 110 | |
| 111 | Now that the `sum.golang.org` entry for `cli` is available the build |
| 112 | should be able to proceed past downloading the dependencies. Builds of |
| 113 | `cli` can take up to 15 minutes so sit tight. |
| 114 | |
| 115 | 8. In [Travis][5] restart the failed, tagged build for `certificates` through |
| 116 | the UI. |
| 117 | |
| 118 | Wait till the build of `cli` has completed successfully. The `step-ca` |
| 119 | dockerfile relies on the `cli:latest` docker build. |
| 120 | |
| 121 | 9. Run `go mod tidy` in both `certificates` and `cli` and commit and push |
| 122 | the changes to `master`. |
| 123 | |
| 124 | 4. **Tag it!** |
| 125 | |
| 126 | > **NOTE**: Skip this step if you've already tagged and pushed in the previous |
| 127 | > step. |
| 128 | |
| 129 | 1. **Create a local tag.** |
| 130 | |
| 131 | ``` |
| 132 | $ git tag v1.0.3 # standard release |
| 133 | ...or |
| 134 | $ git tag v1.0.3-rc.1 # release candidate |
| 135 | ``` |
| 136 | |
| 137 | 2. **Push the new tag to the remote origin.** |
| 138 | |
| 139 | ``` |
| 140 | $ git push origin tag v1.0.3 # standard release |
| 141 | ...or |
| 142 | $ git push origin tag v1.0.3-rc.1 # release candidate |
| 143 | ``` |
| 144 | |
| 145 | Check the build status at [Travis-CI](https://travis-ci.com/smallstep/cli/builds/). |
| 146 | |
| 147 | **All Done!** |
| 148 | |
| 149 | [1]: https://github.com/smallstep/certificates/blob/master/distribution.md |
| 150 | [2]: https://github.com/smallstep/certificates/blob/master/go.mod |
| 151 | [3]: https://github.com/smallstep/cli/blob/master/go.mod |
| 152 | [4]: https://travis-ci.com/smallstep/cli/builds/ |
| 153 | [5]: https://travis-ci.com/smallstep/certificates/builds/ |
| 154 | |
| 155 | ## Versioning |
| 156 | |
| 157 | We use [SemVer](http://semver.org/) for versioning. For the versions available, |
| 158 | see the [tags on this repository](https://github.com/smallstep/cli). |