semantic-release 23.0.8 → 23.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -73,7 +73,7 @@ This way no human is directly involved in the release process and the releases a
73
73
 
74
74
  ### Triggering a release
75
75
 
76
- For each new commit added to one of the release branches (for example: `master`, `next`, `beta`), with `git push` or by merging a pull request or merging from another branch, a CI build is triggered and runs the `semantic-release` command to make a release if there are codebase changes since the last release that affect the package functionalities.
76
+ For each new commit added to one of the release branches (for example: `master`, `main`, `next`, `beta`), with `git push` or by merging a pull request or merging from another branch, a CI build is triggered and runs the `semantic-release` command to make a release if there are codebase changes since the last release that affect the package functionalities.
77
77
 
78
78
  **semantic-release** offers various ways to control the timing, the content and the audience of published releases.
79
79
  See example workflows in the following recipes:
@@ -16,6 +16,7 @@ try {
16
16
  branches: [
17
17
  "+([0-9])?(.{+([0-9]),x}).x",
18
18
  "master",
19
+ "main",
19
20
  "next",
20
21
  "next-major",
21
22
  { name: "beta", prerelease: true },
@@ -133,10 +133,6 @@
133
133
  - `verifyConditions`: Verify the environment variable `PYPI_TOKEN` and installation of build tools
134
134
  - `prepare`: Update the version in `setup.cfg` and create the distribution packages
135
135
  - `publish`: Publish the python package to a repository (default: pypi)
136
- - [semantic-release-helm](https://github.com/m1pl/semantic-release-helm)
137
- - `verifyConditions`: Validate configuration and (if present) credentials
138
- - `prepare`: Update version and appVersion in `Chart.yaml`
139
- - `publish`: Publish the chart to a registry (if configured)
140
136
  - [semantic-release-codeartifact](https://github.com/ryansonshine/semantic-release-codeartifact)
141
137
  - `verifyConditions`: Validate configuration, get AWS CodeArtifact authentication and repository, validate `publishConfig` or `.npmrc` (if they exist), then pass the configuration to the associated plugins.
142
138
  - [semantic-release-telegram](https://github.com/pustovitDmytro/semantic-release-telegram)
@@ -4,7 +4,7 @@
4
4
 
5
5
  The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured with [Secret Variables](https://docs.github.com/en/actions/reference/encrypted-secrets).
6
6
 
7
- In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows.
7
+ In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows.
8
8
 
9
9
  ## npm provenance
10
10
 
@@ -19,7 +19,7 @@ Find more detail about configuring npm to publish with provenance through semant
19
19
 
20
20
  ### `.github/workflows/release.yml` configuration for Node projects
21
21
 
22
- The following is a minimal configuration for [`semantic-release`](https://github.com/semantic-release/semantic-release) with a build running on the latest LTS version of Node when a new commit is pushed to a `master` branch.
22
+ The following is a minimal configuration for [`semantic-release`](https://github.com/semantic-release/semantic-release) with a build running on the latest LTS version of Node when a new commit is pushed to a `master/main` branch.
23
23
  See [Configuring a Workflow](https://help.github.com/en/articles/configuring-a-workflow) for additional configuration options.
24
24
 
25
25
  ```yaml
@@ -27,7 +27,7 @@ name: Release
27
27
  on:
28
28
  push:
29
29
  branches:
30
- - master
30
+ - master # or main
31
31
 
32
32
  permissions:
33
33
  contents: read # for checkout
@@ -61,20 +61,23 @@ jobs:
61
61
  run: npx semantic-release
62
62
  ```
63
63
 
64
- ## Pushing `package.json` changes to a `master` branch
64
+ ## Pushing `package.json` changes to your repository
65
65
 
66
- To keep `package.json` updated in the `master` branch, [`@semantic-release/git`](https://github.com/semantic-release/git) plugin can be used.
66
+ If you choose to commit changes to your `package.json` [against our recommendation](../../support/FAQ.md#making-commits-during-the-release-process-adds-significant-complexity), the [`@semantic-release/git`](https://github.com/semantic-release/git) plugin can be used.
67
67
 
68
- **Note**: Automatically populated `GITHUB_TOKEN` cannot be used if branch protection is enabled for the target branch. It is **not** advised to mitigate this limitation by overriding an automatically populated `GITHUB_TOKEN` variable with a [Personal Access Tokens](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line), as it poses a security risk. Since Secret Variables are available for Workflows triggered by any branch, it becomes a potential vector of attack, where a Workflow triggered from a non-protected branch can expose and use a token with elevated permissions, yielding branch protection insignificant. One can use Personal Access Tokens in trusted environments, where all developers should have the ability to perform administrative actions in the given repository and branch protection is enabled solely for convenience purposes, to remind about required reviews or CI checks.
68
+ **Note**: Automatically populated `GITHUB_TOKEN` cannot be used if branch protection is enabled for the target branch.
69
+ It is **not** advised to mitigate this limitation by overriding an automatically populated `GITHUB_TOKEN` variable with a [Personal Access Tokens](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line), as it poses a security risk.
70
+ Since Secret Variables are available for Workflows triggered by any branch, it becomes a potential vector of attack, where a Workflow triggered from a non-protected branch can expose and use a token with elevated permissions, yielding branch protection insignificant.
71
+ One can use Personal Access Tokens in trusted environments, where all developers should have the ability to perform administrative actions in the given repository and branch protection is enabled solely for convenience purposes, to remind about required reviews or CI checks.
69
72
 
70
73
  If the risk is acceptable, some extra configuration is needed. The [actions/checkout `persist-credentials`](https://github.com/marketplace/actions/checkout#usage) option needs to be `false`, otherwise the generated `GITHUB_TOKEN` will interfere with the custom one. Example:
71
74
 
72
75
  ```yaml
73
76
  - name: Checkout
74
- uses: actions/checkout@v2
75
- with:
76
- fetch-depth: 0
77
- persist-credentials: false # <--- this
77
+ uses: actions/checkout@v2
78
+ with:
79
+ fetch-depth: 0
80
+ persist-credentials: false # <--- this
78
81
  ```
79
82
 
80
83
  ## Trigger semantic-release on demand
@@ -58,7 +58,7 @@ This example is a minimal configuration for **semantic-release** with a build ru
58
58
  **Note**: The`semantic-release` execution command varies depending if you are using a [local](../../usage/installation.md#local-installation) or [global](../../usage/installation.md#global-installation) **semantic-release** installation.
59
59
 
60
60
  ```yaml
61
- # The release pipeline will run only on the master branch a commit is triggered
61
+ # The release pipeline will run only on the master/main branch a commit is triggered
62
62
  stages:
63
63
  - release
64
64
 
@@ -71,7 +71,7 @@ release:
71
71
  script:
72
72
  - semantic-release
73
73
  rules:
74
- - if: $CI_COMMIT_BRANCH == "master"
74
+ - if: $CI_COMMIT_BRANCH == "master" # or main
75
75
 
76
76
  release:
77
77
  image: node:12-buster-slim
@@ -82,7 +82,7 @@ release:
82
82
  script:
83
83
  - semantic-release
84
84
  rules:
85
- - if: $CI_COMMIT_BRANCH == "master"
85
+ - if: $CI_COMMIT_BRANCH == "master" # or main
86
86
  ```
87
87
 
88
88
  ### `package.json` configuration
@@ -4,12 +4,12 @@ This recipe will walk you through a simple example that uses distribution channe
4
4
 
5
5
  This example uses the **semantic-release** default configuration:
6
6
 
7
- - [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
7
+ - [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
8
8
  - [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
9
9
 
10
10
  ## Initial release
11
11
 
12
- We'll start by making the first commit of the project, with the code for the initial release and the message `feat: initial commit` to `master`. When pushing that commit, **semantic-release** will release the version `1.0.0` and make it available on the default distribution channel which is the dist-tag `@latest` for npm.
12
+ We'll start by making the first commit of the project, with the code for the initial release and the message `feat: initial commit` to `master` or `main`. When pushing that commit, **semantic-release** will release the version `1.0.0` and make it available on the default distribution channel which is the dist-tag `@latest` for npm.
13
13
 
14
14
  The Git history of the repository is:
15
15
 
@@ -19,7 +19,7 @@ The Git history of the repository is:
19
19
 
20
20
  ## Releasing a bug fix
21
21
 
22
- We can now continue to commit changes and release updates to our users. For example we can commit a bug fix with the message `fix: a fix` to `master`. When pushing that commit, **semantic-release** will release the version `1.0.1` on the dist-tag `@latest`.
22
+ We can now continue to commit changes and release updates to our users. For example we can commit a bug fix with the message `fix: a fix` to `master` or `main`. When pushing that commit, **semantic-release** will release the version `1.0.1` on the dist-tag `@latest`.
23
23
 
24
24
  The Git history of the repository is now:
25
25
 
@@ -63,7 +63,7 @@ We now want to develop a smaller, non-breaking feature. Its scope is small enoug
63
63
 
64
64
  If we were to commit that feature on `next` only a subset of users would get it, and we would need to wait for the end of our feedback period in order to make both the big and the small feature available to all users.
65
65
 
66
- Instead, we develop that small feature commit it to `master` with the message `feat: a small feature`. When pushing that commit, **semantic-release** will release the version `1.1.0` on the dist-tag `@latest` so all users can benefit from it right away.
66
+ Instead, we develop that small feature commit it to `master` or `main` with the message `feat: a small feature`. When pushing that commit, **semantic-release** will release the version `1.1.0` on the dist-tag `@latest` so all users can benefit from it right away.
67
67
 
68
68
  The Git history of the repository is now:
69
69
 
@@ -78,7 +78,7 @@ The Git history of the repository is now:
78
78
 
79
79
  ## Porting a feature to next
80
80
 
81
- Most of our users now have access to the small feature, but we still need to make it available to our users using the `@next` dist-tag. To do so we need to merge our changes made on `master` (the commit `feat: a small feature`) into `next`. As `master` and `next` branches have diverged, this merge might require to resolve conflicts.
81
+ Most of our users now have access to the small feature, but we still need to make it available to our users using the `@next` dist-tag. To do so we need to merge our changes made on `master` or `main` (the commit `feat: a small feature`) into `next`. As `master`/`main` and `next` branches have diverged, this merge might require to resolve conflicts.
82
82
 
83
83
  Once the conflicts are resolved and the merge commit is pushed to `next`, **semantic-release** will release the version `2.1.0` on the dist-tag `@next` which contains both our small and big feature.
84
84
 
@@ -91,14 +91,14 @@ The Git history of the repository is now:
91
91
  | * feat: a big feature \n\n BREAKING CHANGE: it breaks something # => v2.0.0 on @next
92
92
  | * fix: fix something on the big feature # => v2.0.1 on @next
93
93
  * | feat: a small feature # => v1.1.0 on @latest
94
- | * Merge branch master into next # => v2.1.0 on @next
94
+ | * Merge branch master/main into next # => v2.1.0 on @next
95
95
  ```
96
96
 
97
97
  ## Adding a version to latest
98
98
 
99
- After a period of feedback from our users using the `@next` dist-tag we feel confident to make our big feature available to all users. To do so we merge the `next` branch into `master`. There should be no conflict as `next` is strictly ahead of `master`.
99
+ After a period of feedback from our users using the `@next` dist-tag we feel confident to make our big feature available to all users. To do so we merge the `next` branch into `master`/`main`. There should be no conflict as `next` is strictly ahead of `master`/`main`.
100
100
 
101
- Once the merge commit is pushed to `master`, **semantic-release** will add the version `2.1.0` to the dist-tag `@latest` so all users will receive it when installing out module with `npm install example-module`.
101
+ Once the merge commit is pushed to `master`/`main`, **semantic-release** will add the version `2.1.0` to the dist-tag `@latest` so all users will receive it when installing out module with `npm install example-module`.
102
102
 
103
103
  The Git history of the repository is now:
104
104
 
@@ -109,9 +109,9 @@ The Git history of the repository is now:
109
109
  | * feat: a big feature \n\n BREAKING CHANGE: it breaks something # => v2.0.0 on @next
110
110
  | * fix: fix something on the big feature # => v2.0.1 on @next
111
111
  * | feat: a small feature # => v1.1.0 on @latest
112
- | * Merge branch master into next # => v2.1.0 on @next
112
+ | * Merge branch master/main into next # => v2.1.0 on @next
113
113
  | /|
114
- * | Merge branch next into master # => v2.1.0 on @latest
114
+ * | Merge branch next into master/main # => v2.1.0 on @latest
115
115
  ```
116
116
 
117
- We can now continue to push new fixes and features on `master`, or a new breaking change on `next` as we did before.
117
+ We can now continue to push new fixes and features on `master`/`main`, or a new breaking change on `next` as we did before.
@@ -4,12 +4,12 @@ This recipe will walk you through a simple example that uses Git branches and di
4
4
 
5
5
  This example uses the **semantic-release** default configuration:
6
6
 
7
- - [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
7
+ - [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
8
8
  - [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
9
9
 
10
10
  ## Initial release
11
11
 
12
- We'll start by making the first commit of the project, with the code for the initial release and the message `feat: initial commit`. When pushing that commit, on `master` **semantic-release** will release the version `1.0.0` and make it available on the default distribution channel which is the dist-tag `@latest` for npm.
12
+ We'll start by making the first commit of the project, with the code for the initial release and the message `feat: initial commit`. When pushing that commit, on `master`/`main` **semantic-release** will release the version `1.0.0` and make it available on the default distribution channel which is the dist-tag `@latest` for npm.
13
13
 
14
14
  The Git history of the repository is:
15
15
 
@@ -21,7 +21,7 @@ The Git history of the repository is:
21
21
 
22
22
  We now decide to drop Node.js 6 support for our package, and require Node.js 8 or higher, which is a breaking change.
23
23
 
24
- We commit that change with the message `feat: drop Node.js 6 support \n\n BREAKING CHANGE: Node.js >= 8 required` to `master`. When pushing that commit, **semantic-release** will release the version `2.0.0` on the dist-tag `@latest`.
24
+ We commit that change with the message `feat: drop Node.js 6 support \n\n BREAKING CHANGE: Node.js >= 8 required` to `master`/`main`. When pushing that commit, **semantic-release** will release the version `2.0.0` on the dist-tag `@latest`.
25
25
 
26
26
  The Git history of the repository is now:
27
27
 
@@ -34,7 +34,7 @@ The Git history of the repository is now:
34
34
 
35
35
  One of our users request a new feature, however they cannot migrate to Node.js 8 or higher due to corporate policies.
36
36
 
37
- If we were to push that feature on `master` and release it, the new version would require Node.js 8 or higher as the release would also contain the commit `feat: drop Node.js 6 support \n\n BREAKING CHANGE: Node.js >= 8 required`.
37
+ If we were to push that feature on `master`/`main` and release it, the new version would require Node.js 8 or higher as the release would also contain the commit `feat: drop Node.js 6 support \n\n BREAKING CHANGE: Node.js >= 8 required`.
38
38
 
39
39
  Instead, we create the branch `1.x` from the tag `v1.0.0` with the command `git checkout -b 1.x v1.0.0` and we commit that feature with the message `feat: a feature` to the branch `1.x`. When pushing that commit, **semantic-release** will release the version `1.1.0` on the dist-tag `@release-1.x` so users who can't migrate to Node.js 8 or higher can benefit from it.
40
40
 
@@ -85,13 +85,13 @@ The Git history of the repository is now:
85
85
  | * | Merge branch 1.0.x into 1.x # => v1.1.1 on @1.x
86
86
  ```
87
87
 
88
- ## Porting bug fixes and features to master
88
+ ## Porting bug fixes and features to master/main
89
89
 
90
90
  Finally we want to make both our feature and bug fix available to users using the `@latest` dist-tag.
91
91
 
92
- To do so we need to merge the changes made on `1.x` (the commits `feat: a feature` and `fix: a fix`) into `master`. As `1.x` and `master` branches have diverged, this merge might require to resolve conflicts.
92
+ To do so we need to merge the changes made on `1.x` (the commits `feat: a feature` and `fix: a fix`) into `master`/`main`. As `1.x` and `master`/`main` branches have diverged, this merge might require to resolve conflicts.
93
93
 
94
- Once the conflicts are resolved and the merge commit is pushed to `master`, **semantic-release** will release the version `2.1.0` on the dist-tag `@latest` which now contains the breaking change feature, the feature and the bug fix.
94
+ Once the conflicts are resolved and the merge commit is pushed to `master` or `main`, **semantic-release** will release the version `2.1.0` on the dist-tag `@latest` which now contains the breaking change feature, the feature and the bug fix.
95
95
 
96
96
  The Git history of the repository is now:
97
97
 
@@ -105,14 +105,14 @@ The Git history of the repository is now:
105
105
  | | /|
106
106
  | * | Merge branch 1.0.x into 1.x # => v1.1.1 on @1.x
107
107
  | /| |
108
- * | | Merge branch 1.x into master # => v2.1.0 on @latest
108
+ * | | Merge branch 1.x into master/main # => v2.1.0 on @latest
109
109
  ```
110
110
 
111
111
  ## Releasing a bug fix for version 2.1.0 users
112
112
 
113
113
  One of our users using the version `2.1.0` version reports a bug.
114
114
 
115
- We can simply commit the bug fix with the message `fix: another fix` to `master`. When pushing that commit, **semantic-release** will release the version `2.1.1` on the dist-tag `@latest`.
115
+ We can simply commit the bug fix with the message `fix: another fix` to `master`/`main`. When pushing that commit, **semantic-release** will release the version `2.1.1` on the dist-tag `@latest`.
116
116
 
117
117
  The Git history of the repository is now:
118
118
 
@@ -126,15 +126,15 @@ The Git history of the repository is now:
126
126
  | | /|
127
127
  | * | Merge branch 1.0.x into 1.x # => v1.1.1 on @1.x
128
128
  | /| |
129
- * | | Merge branch 1.x into master # => v2.1.0 on @latest
129
+ * | | Merge branch 1.x into master/main # => v2.1.0 on @latest
130
130
  * | | fix: another fix # => v2.1.1 on @latest
131
131
  ```
132
132
 
133
- ## Porting a bug fix from master to 1.x
133
+ ## Porting a bug fix from master/main to 1.x
134
134
 
135
135
  The bug fix `fix: another fix` also affects version `1.1.1` users, so we want to port it to the `1.x` branch.
136
136
 
137
- To do so we need to cherry pick our fix commit made on `master` (`fix: another fix`) into `1.x` with `git checkout 1.x && git cherry-pick <sha of fix: another fix>`. As `master` and `1.x` branches have diverged, the cherry picking might require to resolve conflicts.
137
+ To do so we need to cherry pick our fix commit made on `master`/`main` (`fix: another fix`) into `1.x` with `git checkout 1.x && git cherry-pick <sha of fix: another fix>`. As `master`/`main` and `1.x` branches have diverged, the cherry picking might require to resolve conflicts.
138
138
 
139
139
  Once the conflicts are resolved and the commit is pushed to `1.x`, **semantic-release** will release the version `1.1.2` on the dist-tag `@release-1.x` which contains `feat: a feature`, `fix: a fix` and `fix: another fix` but not `feat: drop Node.js 6 support \n\n BREAKING CHANGE: Node.js >= 8 required`.
140
140
 
@@ -150,7 +150,7 @@ The Git history of the repository is now:
150
150
  | | /|
151
151
  | * | Merge branch 1.0.x into 1.x # => v1.1.1 on @1.x
152
152
  | /| |
153
- * | | Merge branch 1.x into master # => v2.1.0 on @latest
153
+ * | | Merge branch 1.x into master/main # => v2.1.0 on @latest
154
154
  * | | fix: another fix # => v2.1.1 on @latest
155
155
  | | |
156
156
  | * | fix: another fix # => v1.1.2 on @1.x
@@ -4,12 +4,12 @@ This recipe will walk you through a simple example that uses pre-releases to pub
4
4
 
5
5
  This example uses the **semantic-release** default configuration:
6
6
 
7
- - [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
7
+ - [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
8
8
  - [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
9
9
 
10
10
  ## Initial release
11
11
 
12
- We'll start by making the first commit of the project, with the code for the initial release and the message `feat: initial commit`. When pushing that commit, on `master` **semantic-release** will release the version `1.0.0` and make it available on the default distribution channel which is the dist-tag `@latest` for npm.
12
+ We'll start by making the first commit of the project, with the code for the initial release and the message `feat: initial commit`. When pushing that commit, on `master`/`main` **semantic-release** will release the version `1.0.0` and make it available on the default distribution channel which is the dist-tag `@latest` for npm.
13
13
 
14
14
  The Git history of the repository is:
15
15
 
@@ -46,7 +46,7 @@ With another feature, the Git history of the repository is now:
46
46
 
47
47
  In the meantime we can also continue to commit changes and release updates to our users.
48
48
 
49
- For example, we can commit a bug fix with the message `fix: a fix` to `master`. When pushing that commit, **semantic-release** will release the version `1.0.1` on the dist-tag `@latest`.
49
+ For example, we can commit a bug fix with the message `fix: a fix` to `master`/`main`. When pushing that commit, **semantic-release** will release the version `1.0.1` on the dist-tag `@latest`.
50
50
 
51
51
  The Git history of the repository is now:
52
52
 
@@ -95,9 +95,9 @@ With another feature, the Git history of the repository is now:
95
95
 
96
96
  Once we've developed and pushed all the feature we want to include in the future version `2.0.0` in the `beta` branch and all our tests are successful we can release it to our users.
97
97
 
98
- To do so we need to merge our changes made on `beta` into `master`. As `beta` and `master` branches have diverged, this merge might require to resolve conflicts.
98
+ To do so we need to merge our changes made on `beta` into `master`/`main`. As `beta` and `master`/`main` branches have diverged, this merge might require to resolve conflicts.
99
99
 
100
- Once the conflicts are resolved and the merge commit is pushed to `master`, **semantic-release** will release the version `2.0.0` on the dist-tag `@latest`.
100
+ Once the conflicts are resolved and the merge commit is pushed to `master`/`main`, **semantic-release** will release the version `2.0.0` on the dist-tag `@latest`.
101
101
 
102
102
  The Git history of the repository is now:
103
103
 
@@ -111,14 +111,14 @@ The Git history of the repository is now:
111
111
  | | * feat: first feature of other release \n\n BREAKING CHANGE: it breaks something # => v3.0.0-alpha.1 on @alpha
112
112
  | | * feat: second feature of other release # => v3.0.0-alpha.2 on @alpha
113
113
  | /| |
114
- * | | Merge branch beta into master # => v2.0.0 on @latest
114
+ * | | Merge branch beta into master/main # => v2.0.0 on @latest
115
115
  ```
116
116
 
117
117
  ## Publishing the 3.0.0 alpha release to the beta distribution channel
118
118
 
119
119
  Now that we published our the version `2.0.0` that was previously in beta, we decide to promote the version `3.0.0` in alpha to beta.
120
120
 
121
- To do so we need to merge our changes made on `alpha` into `beta`. There should be no conflict as `alpha` is strictly ahead of `master`.
121
+ To do so we need to merge our changes made on `alpha` into `beta`. There should be no conflict as `alpha` is strictly ahead of `master`/`main`.
122
122
 
123
123
  Once the merge commit is pushed to `beta`, **semantic-release** will publish the pre-release version `3.0.0-beta.1` on the dist-tag `@beta`, which allow us to run our integration tests.
124
124
 
@@ -134,7 +134,7 @@ The Git history of the repository is now:
134
134
  | | * feat: first feature of other release \n\n BREAKING CHANGE: it breaks something # => v3.0.0-alpha.1 on @alpha
135
135
  | | * feat: second feature of other release # => v3.0.0-alpha.2 on @alpha
136
136
  | /| |
137
- * | | Merge branch beta into master # => v2.0.0 on @latest
137
+ * | | Merge branch beta into master/main # => v2.0.0 on @latest
138
138
  | | /|
139
139
  | * | Merge branch alpha into beta # => v3.0.0-beta.1 on @beta
140
140
  ```
@@ -143,9 +143,9 @@ The Git history of the repository is now:
143
143
 
144
144
  Once we've developed and pushed all the feature we want to include in the future version `3.0.0` in the `beta` branch and all our tests are successful we can release it to our users.
145
145
 
146
- To do so we need to merge our changes made on `beta` into `master`. As `beta` and `master` branches have diverged, this merge might require to resolve conflicts.
146
+ To do so we need to merge our changes made on `beta` into `master`/`main`. As `beta` and `master` branches have diverged, this merge might require to resolve conflicts.
147
147
 
148
- Once the conflicts are resolved and the merge commit is pushed to `master`, **semantic-release** will release the version `3.0.0` on the dist-tag `@latest`.
148
+ Once the conflicts are resolved and the merge commit is pushed to `master` or `main`, **semantic-release** will release the version `3.0.0` on the dist-tag `@latest`.
149
149
 
150
150
  The Git history of the repository is now:
151
151
 
@@ -159,18 +159,18 @@ The Git history of the repository is now:
159
159
  | | * feat: first feature of other release \n\n BREAKING CHANGE: it breaks something # => v3.0.0-alpha.1 on @alpha
160
160
  | | * feat: second feature of other release # => v3.0.0-alpha.2 on @alpha
161
161
  | /| |
162
- * | | Merge branch beta into master # => v2.0.0 on @latest
162
+ * | | Merge branch beta into master/main # => v2.0.0 on @latest
163
163
  | | /|
164
164
  | * | Merge branch alpha into beta # => v3.0.0-beta.1 on @beta
165
165
  | /| |
166
- * | | Merge branch beta into master # => v3.0.0 on @latest
166
+ * | | Merge branch beta into master/main # => v3.0.0 on @latest
167
167
  ```
168
168
 
169
169
  ## Working on a third future release
170
170
 
171
171
  We can now start to work on a new future major release, version `4.0.0`, on the `@beta` distribution channel.
172
172
 
173
- To do so we first need to update the `beta` branch with all the changes from `master` (the commits `fix: a fix`). As `beta` and `master` branches have diverged, this merge might require to resolve conflicts.
173
+ To do so we first need to update the `beta` branch with all the changes from `master` or `main` (the commits `fix: a fix`). As `beta` and `master`/`main` branches have diverged, this merge might require to resolve conflicts.
174
174
 
175
175
  We can now commit our new feature on `beta`. When pushing that commit, **semantic-release** will publish the pre-release version `3.1.0-beta.1` on the dist-tag `@beta`. That allow us to run integration tests by installing our module with `npm install example-module@beta`. Other users installing with `npm install example-module` will still receive the version `3.0.0`.
176
176
 
@@ -186,12 +186,12 @@ The Git history of the repository is now:
186
186
  | | * feat: first feature of other release \n\n BREAKING CHANGE: it breaks something # => v3.0.0-alpha.1 on @alpha
187
187
  | | * feat: second feature of other release # => v3.0.0-alpha.2 on @alpha
188
188
  | /| |
189
- * | | Merge branch beta into master # => v2.0.0 on @latest
189
+ * | | Merge branch beta into master/main # => v2.0.0 on @latest
190
190
  | | /|
191
191
  | * | Merge branch alpha into beta # => v3.0.0-beta.1 on @beta
192
192
  | /| |
193
- * | | Merge branch beta into master # => v3.0.0 on @latest
193
+ * | | Merge branch beta into master/main # => v3.0.0 on @latest
194
194
  | \| |
195
- | * | Merge branch master into beta
195
+ | * | Merge branch master/main into beta
196
196
  | * | feat: new feature # => v3.1.0-beta.1 on @beta
197
197
  ```
@@ -2,13 +2,52 @@
2
2
 
3
3
  ## Why is the `package.json`’s version not updated in my repository?
4
4
 
5
- [`@semantic-release/npm`](https://github.com/semantic-release/npm) takes care of updating the `package.json`’s version before publishing to [npm](https://www.npmjs.com).
5
+ ### It is not needed for semantic-release to do its job
6
6
 
7
- By default, only the published package will contain the version, which is the only place where it is _really_ required, but the updated `package.json` will not be pushed to the Git repository
7
+ [`@semantic-release/npm`](https://github.com/semantic-release/npm) takes care of updating the `package.json`’s version before publishing to [npm](https://www.npmjs.com) based on the previous version that was tracked as a git tag.
8
+ By default, only the published package will contain the version, which is the only place where it is _really_ required, but the updated `package.json` will not be pushed to the Git repository.
9
+ A git tag is added to track the new version, so committing the version is not necessary for semantic-release to pick up from there for the next release.
8
10
 
9
- However, the [`@semantic-release/git`](https://github.com/semantic-release/git) plugin can be used to push the updated `package.json` as well as other files to the Git repository.
11
+ ### It can lead to confusion
10
12
 
11
- If you wish to only update the `package.json` and push via Git you can set the project to `"private": true,` within your `package.json` to prevent publishing to [the npm registry](https://www.npmjs.com).
13
+ Some teams find value in being able to reference the repository to determine the current latest version available for the published package.
14
+ Unfortunately, there are some failure scenarios where semantic-release might leave the committed version in the repository out of sync with the version that exists in the registry.
15
+ The best way to determine available versions is to consult the registry that your package is published to, since it is the actual source of truth.
16
+ The [npm CLI](https://docs.npmjs.com/cli/npm) can be used to consult the registry with the following command:
17
+
18
+ ```shell
19
+ npm dist-tags ls <package-name>
20
+ ```
21
+
22
+ When not committing updates to the version, a value that follows the semver guidelines is still required for the `version` property within the `package.json`.
23
+ To make it clear to contributors that the version is not kept up to date, we recommend using a value like `0.0.0-development` or `0.0.0-semantically-released`.
24
+
25
+ ### Making commits during the release process adds significant complexity
26
+
27
+ While the [`@semantic-release/git`](https://github.com/semantic-release/git) enables committing such changes and pushing them back to the repository as part of a release, we strongly recommend against this practice.
28
+
29
+ Making commits and pushing them back to the repository adds significant additional complexity to your release process that can be avoided:
30
+
31
+ - Branch protection configuration must account for allowing the release user account to bypass restrictions enforced for human contributors, which might require elevating the access level of the release user beyond what would otherwise be desired/considered secure.
32
+ - Pre-commit hooks configured for a project, which is a popular practice when enabling [commitlint](https://commitlint.js.org/) through [husky](https://typicode.github.io/husky/), for example, must be accounted for in the release process.
33
+ (We recommend disabling tools like this for automated commits, but you need to decide what is appropriate for your project)
34
+
35
+ ### There are valid reasons to commit during a release
36
+
37
+ If you make your npm package available directly via a GitHub repository rather than publishing to a registry, for example, making a commit and pushing to the repository is a necessary step.
38
+ In such a case you will want to use [`@semantic-release/git`](https://github.com/semantic-release/git) to coordinate the commit and push.
39
+ You can set the project to `"private": true,` within your `package.json` to [prevent publishing to the registry](https://docs.npmjs.com/cli/v10/using-npm/registry#how-can-i-prevent-my-package-from-being-published-in-the-official-registry).
40
+
41
+ However, if you are choosing to follow this path because you can't use the official npm registry and don't want to manage your own registry, consider [publishing to GitHub packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry) instead.
42
+
43
+ ## Should release notes be committed to a `CHANGELOG.md` in my repository during a release?
44
+
45
+ [`@semantic-release/changelog`](https://github.com/semantic-release/changelog) can be used to add release notes to a `CHANGELOG.md` file within your repository as part of each release.
46
+ Committing changes to a `CHANGELOG.md` or similar file introduces the same [complexities](#making-commits-during-the-release-process-adds-significant-complexity) as committing an updated version within a `package.json` file.
47
+ In addition, the release notes that would be added to a changelog file are likely redundant with the release notes added as GitHub releases, if that is also configured for your project (enabled by default).
48
+
49
+ Before deciding that a changelog file is necessary for your project, please consider whether the added complexity is worth it when GitHub releases (or similar for your host, if not GitHub) might accomplish the same goal.
50
+ It could also be worth considering whether having a `CHANGELOG.md` in your repository that only contains a link to the project's GitHub releases could be an acceptable middle ground.
12
51
 
13
52
  ## How can I use a npm build script that requires the `package.json`’s version ?
14
53
 
@@ -183,11 +222,11 @@ This is fully customizable with the [`@semantic-release/commit-analyzer`](https:
183
222
 
184
223
  ## Is it _really_ a good idea to release on every push?
185
224
 
186
- It is indeed a great idea because it _forces_ you to follow best practices. If you don’t feel comfortable releasing every feature or fix on your `master` you might not treat your `master` branch as intended.
225
+ It is indeed a great idea because it _forces_ you to follow best practices. If you don’t feel comfortable releasing every feature or fix on your `master`/`main` you might not treat your `master`/`main` branch as intended.
187
226
 
188
227
  From [Understanding the GitHub Flow](https://guides.github.com/introduction/flow/index.html):
189
228
 
190
- > Branching is a core concept in Git, and the entire GitHub Flow is based upon it. There's only one rule: anything in the master branch is always deployable.
229
+ > Branching is a core concept in Git, and the entire GitHub Flow is based upon it. There's only one rule: anything in the master/main branch is always deployable.
191
230
 
192
231
  If you need more control over the timing of releases, see [Triggering a release](../../README.md#triggering-a-release) for different options.
193
232
 
@@ -66,5 +66,5 @@ To recover from that situation, do the following:
66
66
 
67
67
  1. Delete the tag(s) for the release(s) that have been lost from the git history. You can delete each tag from remote using `git push origin -d :[TAG NAME]`, e.g. `git push origin -d :v2.0.0-beta.1`. You can delete tags locally using `git tag -d [TAG NAME]`, e.g. `git tag -d v2.0.0-beta.1`.
68
68
  2. Re-create the tags locally: `git tag [TAG NAME] [COMMIT HASH]`, where `[COMMIT HASH]` is the new commit that created the release for the lost tag. E.g. `git tag v2.0.0-beta.1 abcdef0`
69
- 3. Re-create the git notes for each release tag, e.g. `git notes --ref semantic-release add -f -m '{"channels":["beta"]}' v2.0.0-beta.1`. If the release was also published in the default channel (usually `master`), then set the first channel to `null`, e.g. `git notes --ref semantic-release add -f -m '{"channels":[null, "beta"]}'`
69
+ 3. Re-create the git notes for each release tag, e.g. `git notes --ref semantic-release add -f -m '{"channels":["beta"]}' v2.0.0-beta.1`. If the release was also published in the default channel (usually `master`/`main`), then set the first channel to `null`, e.g. `git notes --ref semantic-release add -f -m '{"channels":[null, "beta"]}'`
70
70
  4. Push the local notes: `git push --force origin refs/notes/semantic-release`. The `--force` is needed after the rebase. Be careful.
@@ -20,7 +20,7 @@ Additionally, metadata of Git tags generated by **semantic-release** can be cust
20
20
 
21
21
  Alternatively, some options can be set via CLI arguments.
22
22
 
23
- The following three examples are the same.
23
+ The following three examples are the same. Use main instead of master if your default branch is main.
24
24
 
25
25
  - Via `release` key in the project's `package.json` file:
26
26
 
@@ -77,19 +77,21 @@ List of modules or file paths containing a [shareable configuration](shareable-c
77
77
  ### branches
78
78
 
79
79
  Type: `Array`, `String`, `Object`<br>
80
- Default: `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`<br>
80
+ Default: `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`<br>
81
81
  CLI arguments: `--branches`
82
82
 
83
83
  The branches on which releases should happen. By default **semantic-release** will release:
84
84
 
85
- - regular releases to the default distribution channel from the branch `master`
85
+ - regular releases to the default distribution channel from the branch `master` or `main`
86
86
  - regular releases to a distribution channel matching the branch name from any existing branch with a name matching a maintenance release range (`N.N.x` or `N.x.x` or `N.x` with `N` being a number)
87
87
  - regular releases to the `next` distribution channel from the branch `next` if it exists
88
88
  - regular releases to the `next-major` distribution channel from the branch `next-major` if it exists
89
89
  - pre-releases to the `beta` distribution channel from the branch `beta` if it exists
90
90
  - pre-releases to the `alpha` distribution channel from the branch `alpha` if it exists
91
91
 
92
- **Note**: If your repository does not have a release branch, then **semantic-release** will fail with an `ERELEASEBRANCHES` error message. If you are using the default configuration, you can fix this error by pushing a `master` branch.
92
+ **Note**: Branches configuration key accepts [**micromatch**](https://github.com/micromatch/micromatch?tab=readme-ov-file#matching-features) globs.
93
+
94
+ **Note**: If your repository does not have a release branch, then **semantic-release** will fail with an `ERELEASEBRANCHES` error message. If you are using the default configuration, you can fix this error by pushing a `master` or `main` branch.
93
95
 
94
96
  **Note**: Once **semantic-release** is configured, any user with the permission to push commits on one of those branches will be able to publish a release. It is recommended to protect those branches, for example with [GitHub protected branches](https://docs.github.com/github/administering-a-repository/about-protected-branches).
95
97
 
@@ -173,7 +175,7 @@ If a release has been published before setting up **semantic-release** you must
173
175
 
174
176
  If the previous releases were published with [`npm publish`](https://docs.npmjs.com/cli/publish) this should already be the case.
175
177
 
176
- For example, if your release branch is `master`, the last release published on your project is `1.1.0` and the last commit included has the sha `1234567`, you must make sure this commit is in `master` history and is tagged with `v1.1.0`.
178
+ For example, if your release branch is `master`/`main`, the last release published on your project is `1.1.0` and the last commit included has the sha `1234567`, you must make sure this commit is in `master`/`main` history and is tagged with `v1.1.0`.
177
179
 
178
180
  ```bash
179
181
  # Make sure the commit 1234567 is in the release branch history
@@ -1,11 +1,12 @@
1
- # Workflow configuration
1
+ # Release Workflow configuration
2
2
 
3
- **semantic-release** allow to manage and automate complex release workflow, based on multiple Git branches and distribution channels. This allow to:
3
+ **semantic-release** enables managing and automating complex release workflow, based on multiple Git branches and distribution channels.
4
+ This enables:
4
5
 
5
- - Distribute certain releases to a particular group of users via distribution channels
6
- - Manage the availability of releases on distribution channels via branches merge
7
- - Maintain multiple lines of releases in parallel
8
- - Work on large future releases outside the normal flow of one version increment per Git push
6
+ - Distributing certain releases to a particular group of users via distribution channels
7
+ - Managing the availability of releases on distribution channels via branches merge
8
+ - Maintaining multiple lines of releases in parallel
9
+ - Working on large future releases outside the normal flow of one version increment per Git push
9
10
 
10
11
  See [Release workflow recipes](../recipes/release-workflow/README.md#release-workflow) for detailed examples.
11
12
 
package/index.d.ts CHANGED
@@ -445,7 +445,7 @@ declare module "semantic-release" {
445
445
  * **semantic-release** will release:
446
446
  *
447
447
  * * regular releases to the default distribution channel from the
448
- * branch `master`
448
+ * branch `master` / `main`
449
449
  * * regular releases to a distribution channel matching the branch
450
450
  * name from any existing branch with a name matching a maintenance
451
451
  * release range (`N.N.x` or `N.x.x` or `N.x` with `N` being a
@@ -462,7 +462,7 @@ declare module "semantic-release" {
462
462
  * **Note**: If your repository does not have a release branch, then
463
463
  * **semantic-release** will fail with an `ERELEASEBRANCHES` error
464
464
  * message. If you are using the default configuration, you can fix
465
- * this error by pushing a `master` branch.
465
+ * this error by pushing a `master`/`main branch.
466
466
  *
467
467
  * **Note**: Once **semantic-release** is configured, any user with the
468
468
  * permission to push commits on one of those branches will be able to
@@ -587,7 +587,7 @@ declare module "semantic-release" {
587
587
  * **semantic-release** will release:
588
588
  *
589
589
  * * regular releases to the default distribution channel from the
590
- * branch `master`
590
+ * branch `master`/`main
591
591
  * * regular releases to a distribution channel matching the branch
592
592
  * name from any existing branch with a name matching a maintenance
593
593
  * release range (`N.N.x` or `N.x.x` or `N.x` with `N` being a
@@ -604,7 +604,7 @@ declare module "semantic-release" {
604
604
  * **Note**: If your repository does not have a release branch, then
605
605
  * **semantic-release** will fail with an `ERELEASEBRANCHES` error
606
606
  * message. If you are using the default configuration, you can fix
607
- * this error by pushing a `master` branch.
607
+ * this error by pushing a `master`/`main` branch.
608
608
  *
609
609
  * **Note**: Once **semantic-release** is configured, any user with the
610
610
  * permission to push commits on one of those branches will be able to
@@ -240,7 +240,7 @@ export function ERELEASEBRANCHES({ branches }) {
240
240
  "docs/usage/configuration.md#branches"
241
241
  )}).
242
242
 
243
- This may occur if your repository does not have a release branch, such as \`master\`.
243
+ This may occur if your repository does not have a release branch, such as \`master\` or \`main\`.
244
244
 
245
245
  Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
246
246
  };
package/lib/get-config.js CHANGED
@@ -64,6 +64,7 @@ export default async (context, cliOptions) => {
64
64
  branches: [
65
65
  "+([0-9])?(.{+([0-9]),x}).x",
66
66
  "master",
67
+ "main",
67
68
  "next",
68
69
  "next-major",
69
70
  { name: "beta", prerelease: true },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "semantic-release",
3
3
  "description": "Automated semver compliant package publishing",
4
- "version": "23.0.8",
4
+ "version": "23.1.0",
5
5
  "type": "module",
6
6
  "author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
7
7
  "ava": {
@@ -58,7 +58,7 @@
58
58
  "yargs": "^17.5.1"
59
59
  },
60
60
  "devDependencies": {
61
- "ava": "6.1.2",
61
+ "ava": "6.1.3",
62
62
  "c8": "9.1.0",
63
63
  "clear-module": "4.1.2",
64
64
  "codecov": "3.8.3",
@@ -76,7 +76,7 @@
76
76
  "p-retry": "6.2.0",
77
77
  "prettier": "3.2.5",
78
78
  "publint": "0.2.7",
79
- "sinon": "17.0.1",
79
+ "sinon": "17.0.2",
80
80
  "stream-buffers": "3.0.2",
81
81
  "tempy": "3.1.0",
82
82
  "testdouble": "3.20.2"
@@ -162,5 +162,5 @@
162
162
  "github>semantic-release/.github:renovate-config"
163
163
  ]
164
164
  },
165
- "packageManager": "npm@10.5.1"
165
+ "packageManager": "npm@10.7.0"
166
166
  }