Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 989ac12

Browse files
committed
docs: Add documentation for releases and commit style
1 parent a5d39ad commit 989ac12

File tree

2 files changed

+75
-12
lines changed

2 files changed

+75
-12
lines changed

docs/CONTRIBUTING.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,51 @@ one or more reviewers making new comments every time, then waiting for an
199199
updated change before reviewing again. All contributors, including those from
200200
maintainers, are subject to the same review cycle; this process is not meant to
201201
be applied selectively or to discourage anyone from contributing.
202+
203+
## Releases
204+
205+
Coder releases are automated via GitHub Actions. Specifically, the
206+
[`release.yaml`](../.github/workflows/release.yaml) workflow. They are created
207+
based on the current [`main`](https://github.com/coder/coder/tree/main) branch.
208+
209+
The release notes for a release are automatically generated from commit titles
210+
and metadata from PRs that are merged into `main`.
211+
212+
### Creating a release (script)
213+
214+
The preferred way to create a release is to use [`./scripts/release.sh`](../scripts/release.sh). This script will show a preview of the release that _would_ be created and if you choose to continue, automatically run and watch the release workflow for you.
215+
216+
See `./scripts/release.sh --help` for more information.
217+
218+
### Creating a release (workflow dispatch)
219+
220+
Alternatively, the workflow can be dispatched manually from [Actions: Release](https://github.com/coder/coder/actions/workflows/release.yaml). Simply press "Run workflow" and set your preferred inputs.
221+
222+
### Commit messages
223+
224+
Commit messages should follow the [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) specification.
225+
226+
Allowed commit types (`feat`, `fix`, etc.) are listed in [conventional-commit-types](https://github.com/commitizen/conventional-commit-types/blob/c3a9be4c73e47f2e8197de775f41d981701407fb/index.json). Note that these types are also used to automatically sort and organize the release notes.
227+
228+
A good commit message title uses the imperative, present tense and is ~50
229+
characters long (no more than 72).
230+
231+
Examples:
232+
233+
- Good: `feat(api): Add feature X`
234+
- Bad: `feat(api): Added feature X` (past tense)
235+
236+
A good rule of thumb for writing good commit messages is to recite: [If applied, this commit will ...](https://reflectoring.io/meaningful-commit-messages/).
237+
238+
**Note:** We lint PR titles to ensure they follow the Conventional Commits specification, however, it's still possible to merge PRs on GitHub with a badly formatted title. Take care when merging single-commit PRs as GitHub may prefer to use the original commit title instead of the PR title.
239+
240+
### Breaking changes
241+
242+
Breaking changes can be triggered in two ways:
243+
244+
- Add `!` to the commit message title, e.g. `feat(api)!: Remove deprecated endpoint /test`
245+
- Add the [`release/breaking`](https://github.com/coder/coder/issues?q=sort%3Aupdated-desc+label%3Arelease%2Fbreaking) label to a PR that has, or will be, merged into `main`.
246+
247+
### Security
248+
249+
The [`security`](https://github.com/coder/coder/issues?q=sort%3Aupdated-desc+label%3Asecurity) label can be added to PRs that have, or will be, merged into `main`. Doing so will make sure the change stands out in the release notes.

scripts/release.sh

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cdroot
77

88
usage() {
99
cat <<EOH
10-
Usage: ./release.sh [--branch <name>] [--draft] [--dry-run] [--ref <ref>] [--major | --minor | --patch]
10+
Usage: ./release.sh [-h | --help] [--draft] [--dry-run] [--major | --minor | --patch]
1111
1212
This script should be called to create a new release.
1313
@@ -17,23 +17,38 @@ based on if the release contains breaking changes or not. If the release
1717
contains breaking changes, a new minor version will be created. Otherwise, a
1818
new patch version will be created.
1919
20-
Set --ref if you need to specify a specific commit that the new version will
21-
be tagged at, otherwise the latest commit will be used.
20+
To mark a release as containing breaking changes, the commit title should
21+
either contain a known prefix with an exclamation mark ("feat!:",
22+
"feat(api)!:") or the PR that was merged can be tagged with the
23+
"release/breaking" label.
24+
25+
GitHub labels that affect release notes:
26+
27+
- release/breaking: Shown under BREAKING CHANGES, prevents patch release.
28+
- security: Shown under SECURITY.
29+
30+
Flags:
31+
32+
Set --major or --minor to force a larger version bump, even when there are no
33+
breaking changes. By default a patch version will be created, --patch is no-op.
2234
23-
Set --minor to force a minor version bump, even when there are no breaking
24-
changes. Likewise for --major. By default a patch version will be created.
35+
Set --draft to create a draft release, this is to allow you to modify release
36+
notes in the GitHub UI before publishing.
2537
2638
Set --dry-run to run the release workflow in CI as a dry-run (no release will
2739
be created).
2840
29-
To mark a release as containing breaking changes, the commit title should
30-
either contain a known prefix with an exclamation mark ("feat!:",
31-
"feat(api)!:") or the PR that was merged can be tagged with the
32-
"release/breaking" label.
41+
Development:
42+
43+
Usage: ./release.sh [-h | --help] [--branch <branch>] [--draft] [--dry-run] [--major | --minor | --patch] [--ref <ref>]
44+
45+
Flags:
46+
47+
Set --ref if you need to specify a specific commit that the new version will
48+
be tagged at, otherwise the latest commit will be used.
3349
34-
To test changes to this script, you can set --branch <my-branch>, which will
35-
run the release workflow in CI as a dry-run and use the latest commit on the
36-
specified branch as the release commit. This will also set --dry-run.
50+
Set --branch if you are testing changes to the release process on a custom
51+
branch. This flag implies --dry-run and no actual release will be created.
3752
EOH
3853
}
3954

0 commit comments

Comments
 (0)