Skip to content

Commit a9a1a57

Browse files
authored
docs(MAINTAINING): initial version (octokit#2322)
1 parent 4652c68 commit a9a1a57

File tree

2 files changed

+93
-32
lines changed

2 files changed

+93
-32
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,6 @@ npm install https://github.pika.dev/octokit/<repository name>/pr/[PULL REQUEST N
5151

5252
Once you are done testing, you can revert to the default module `@octokit/<repository name>` from npm with `npm install @octokit/<repository name>`
5353

54-
## Maintainers only
54+
## Maintainers
5555

56-
### Merging the Pull Request & releasing a new version
57-
58-
Releases are automated using [semantic-release](https://github.com/semantic-release/semantic-release).
59-
The following commit message conventions determine which version is released:
60-
61-
1. `fix: ...` or `fix(scope name): ...` prefix in subject: bumps fix version, e.g. `1.2.3``1.2.4`
62-
2. `feat: ...` or `feat(scope name): ...` prefix in subject: bumps feature version, e.g. `1.2.3``1.3.0`
63-
3. `BREAKING CHANGE:` in body: bumps breaking version, e.g. `1.2.3``2.0.0`
64-
65-
Only one version number is bumped at a time, the highest version change trumps the others.
66-
Besides, publishing a new version to npm, semantic-release also creates a git tag and release
67-
on GitHub, generates changelogs from the commit messages and puts them into the release notes.
68-
69-
Before the publish it runs the `npm run build` script which creates a `pkg/` folder with distributions for browsers, node and Typescript definitions. The contents of the `pkg/` folder are published to the npm registry.
70-
71-
If the pull request looks good but does not follow the commit conventions, use the <kbd>Squash & merge</kbd> button.
72-
73-
> ⚠️ making sure the message is semantic-release compliant before clicking <kbd>Confirm squash and merge</kbd>:
74-
75-
![Screenshot of GitHub's Squash and Merge confirm dialog](assets/squash-and-merge-dialog.png)]
76-
77-
### Troubleshooting
78-
79-
<details>
80-
<summary>What can I do if I <i>squashed and merged</i> with a commit message which is not <a href="https://github.com/semantic-release/semantic-release">semantic-release</a> compliant?</summary>
81-
82-
1. After merging, do a follow up on `https://github.com/octokit/<repository name>/actions/workflows/release.yml` to assure your commit is not triggering any release. You can find an example of a commit squashed and merged with a non semantic-release commit message [here](https://github.com/octokit/plugin-throttling.js/runs/5390685684?check_suite_focus=true)
83-
2. Mention (`@username`) the maintainers of the project in your merged _Pull Request_ to let them know there was an issue with your merged _Pull Request_. We need to make sure no _Pull Request_ is merged until this issue is addressed.
84-
3. Open a new _Pull Request_ with an [empty commit](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---allow-empty). In the description, link to the previous merged _Pull Request_ to give context to the reviewers and request a Review from the maintainers. This time make sure the message is [semantic-release](https://github.com/semantic-release/semantic-release) compliant.
85-
86-
</details>
56+
See [MAINTAINING.md](MAINTAINING.md)

MAINTAINING.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Maintenance releases
2+
3+
## Merging the Pull Request & releasing a new version
4+
5+
Releases are automated using [semantic-release](https://github.com/semantic-release/semantic-release).
6+
The following commit message conventions determine which version is released:
7+
8+
1. `fix: ...` or `fix(scope name): ...` prefix in subject: bumps fix version, e.g. `1.2.3``1.2.4`
9+
2. `feat: ...` or `feat(scope name): ...` prefix in subject: bumps feature version, e.g. `1.2.3``1.3.0`
10+
3. `BREAKING CHANGE:` in body: bumps breaking version, e.g. `1.2.3``2.0.0`
11+
12+
Only one version number is bumped at a time, the highest version change trumps the others.
13+
Besides, publishing a new version to npm, semantic-release also creates a git tag and release
14+
on GitHub, generates changelogs from the commit messages and puts them into the release notes.
15+
16+
Before the publish it runs the `npm run build` script which creates a `pkg/` folder with distributions for browsers, node and Typescript definitions. The contents of the `pkg/` folder are published to the npm registry.
17+
18+
If the pull request looks good but does not follow the commit conventions, use the <kbd>Squash & merge</kbd> button.
19+
20+
> ⚠️ making sure the message is semantic-release compliant before clicking <kbd>Confirm squash and merge</kbd>:
21+
22+
![Screenshot of GitHub's Squash and Merge confirm dialog](assets/squash-and-merge-dialog.png)]
23+
24+
## Maintenance releases
25+
26+
### 0. Requirements
27+
28+
`semantic-release` is configured in the `package.json` of each repository. If `release.branches` is set, make sure that it includes the line for maintenance releases, for example
29+
30+
```js
31+
"release": {
32+
"branches": [
33+
"+([0-9]).x",
34+
"main",
35+
"beta"
36+
],
37+
```
38+
39+
`semantic-release` is run in the`.github/workflows/release.yml` GitHub Action workflow. Make sure it's triggered on push in the `*.x` release branches.
40+
41+
```yml
42+
name: Release
43+
"on":
44+
push:
45+
branches:
46+
- main
47+
- next
48+
- beta
49+
- "*.x"
50+
```
51+
52+
### 1. Create a branch for the maintenance version
53+
54+
Find the latest version that was released on the maintenance version. For example, if the current version is 3.1, and you want to release maintenance versions for 2.x, then find the latest 2.x version. Say that's 2.10.9. In that example, create a tag based on this tag
55+
56+
```
57+
git checkout -b 2.x v2.10.9
58+
```
59+
60+
Then push the new `2.x` branch to GitHub
61+
62+
```
63+
git push -u origin HEAD
64+
```
65+
66+
### 2. Create a pull request with the changes for the new maintenance release
67+
68+
Checkout a branch based on the latest maintenance branch, for example
69+
70+
```
71+
git checkout -b 2.x-my-fix 2.x
72+
```
73+
74+
Commit your changes, then push the branch to GitHub and create a pull request with the maintenance branch as base.
75+
76+
### 3. Merge the pull request with the correct commit message
77+
78+
Note that maintenance versions only support `fix: ...` and `feat: ...` commits, no breaking versions can be released from a maintenance release.
79+
80+
The `.github/workflows/release.yml` action should pick up the commit and release the correct version to both GitHub and npm. The npm release will use a `@release-*.x` tag so that the new release is not picked up as `@latest`.
81+
82+
## Troubleshooting
83+
84+
<details>
85+
<summary>What can I do if I <i>squashed and merged</i> with a commit message which is not <a href="https://github.com/semantic-release/semantic-release">semantic-release</a> compliant?</summary>
86+
87+
1. After merging, do a follow up on `https://github.com/octokit/<repository name>/actions/workflows/release.yml` to assure your commit is not triggering any release. You can find an example of a commit squashed and merged with a non semantic-release commit message [here](https://github.com/octokit/plugin-throttling.js/runs/5390685684?check_suite_focus=true)
88+
2. Mention (`@username`) the maintainers of the project in your merged _Pull Request_ to let them know there was an issue with your merged _Pull Request_. We need to make sure no _Pull Request_ is merged until this issue is addressed.
89+
3. Open a new _Pull Request_ with an [empty commit](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---allow-empty). In the description, link to the previous merged _Pull Request_ to give context to the reviewers and request a Review from the maintainers. This time make sure the message is [semantic-release](https://github.com/semantic-release/semantic-release) compliant.
90+
91+
</details>

0 commit comments

Comments
 (0)