You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-24Lines changed: 16 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,45 +47,36 @@ When publishing to the [official registry](https://registry.npmjs.org/), it is r
47
47
-[Granular access tokens](https://docs.npmjs.com/creating-and-viewing-access-tokens#creating-granular-access-tokens-on-the-website) are recommended when publishing from a CI provider that is not supported by npm for trusted publishing, and can be set via [environment variables](#environment-variables).
48
48
Because these access tokens expire, rotation will need to be accounted for in this scenario.
49
49
50
-
### Alternative Registries
51
-
52
-
The npm token authentication configuration is **required** and can be set via [environment variables](#environment-variables).
53
-
See the documentation for your registry for details on how to create a token for automation.
54
-
55
-
### npm provenance
56
-
57
-
If you are publishing to the official registry and your pipeline is on a [provider that is supported by npm for provenance](https://docs.npmjs.com/generating-provenance-statements#provenance-limitations), npm can be configured to [publish with provenance](https://docs.npmjs.com/generating-provenance-statements).
58
-
59
-
Since semantic-release wraps the npm publish command, configuring provenance is not exposed directly.
60
-
Instead, provenance can be configured through the [other configuration options exposed by npm](https://docs.npmjs.com/generating-provenance-statements#using-third-party-package-publishing-tools).
61
-
Provenance applies specifically to publishing, so our recommendation is to configure under `publishConfig` within the `package.json`.
62
-
63
-
> [!NOTE]
64
-
> When publishing a public package to the official registry with OIDC, [npm provenance is automatically enabled](https://docs.npmjs.com/trusted-publishers#automatic-provenance-generation) and does not require any additional configuration.
50
+
#### Trusted publishing from GitHub Actions
65
51
66
-
#### npm provenance on GitHub Actions
67
-
68
-
For package provenance to be signed on the GitHub Actions CI the following permission is required
69
-
to be enabled on the job:
52
+
To publish with OIDC from GitHub Actions, the `id-token: write` permission is required to be enabled on the job:
70
53
71
54
```yaml
72
55
permissions:
73
-
id-token: write # to enable use of OIDC for npm provenance
56
+
id-token: write # to enable use of OIDC for trusted publishing and npm provenance
74
57
```
75
58
76
-
It's worth noting that if you are using semantic-release to its fullest with a GitHub release, GitHub comments,
59
+
> [!NOTE]
60
+
> When using trusted publishing, provenance attestations are automatically generated for your packages without requiring provenance to be explicitly enabled.
61
+
62
+
It's also worth noting that if you are using semantic-release to its fullest with a GitHub release, GitHub comments,
77
63
and other features, then [more permissions are required](https://github.com/semantic-release/github#github-authentication) to be enabled on this job:
78
64
79
65
```yaml
80
66
permissions:
81
67
contents: write # to be able to publish a GitHub release
82
68
issues: write # to be able to comment on released issues
83
69
pull-requests: write # to be able to comment on released pull requests
84
-
id-token: write # to enable use of OIDC for npm provenance
70
+
id-token: write # to enable use of OIDC for trusted publishing and npm provenance
85
71
```
86
72
87
73
Refer to the [GitHub Actions recipe for npm package provenance](https://semantic-release.gitbook.io/semantic-release/recipes/ci-configurations/github-actions#.github-workflows-release.yml-configuration-for-node-projects) for the full CI job's YAML code example.
88
74
75
+
### Alternative Registries
76
+
77
+
The npm token authentication configuration is **required** and can be set via [environment variables](#environment-variables).
78
+
See the documentation for your registry for details on how to create a token for automation.
79
+
89
80
### Environment variables
90
81
91
82
| Variable | Description |
@@ -110,13 +101,14 @@ The plugin uses the [`npm` CLI](https://github.com/npm/cli) which will read the
110
101
111
102
The [`registry`](https://docs.npmjs.com/misc/registry) can be configured via the npm environment variable `NPM_CONFIG_REGISTRY` and will take precedence over the configuration in `.npmrc`.
112
103
113
-
The [`registry`](https://docs.npmjs.com/misc/registry) and [`dist-tag`](https://docs.npmjs.com/cli/dist-tag) can be configured under `publishConfig` in the `package.json`:
104
+
The [`registry`](https://docs.npmjs.com/misc/registry), [`dist-tag`](https://docs.npmjs.com/cli/dist-tag), and [`provenance`](https://docs.npmjs.com/generating-provenance-statements#using-third-party-package-publishing-tools) can be configured under `publishConfig` in the `package.json`:
0 commit comments