@anolilab/semantic-release-pnpm 8.0.0 → 8.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/CHANGELOG.md +10 -0
- package/README.md +26 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## @anolilab/semantic-release-pnpm [8.1.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@8.0.0...@anolilab/semantic-release-pnpm@8.1.0) (2026-04-08)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **semantic-release-pnpm:** add generic and CircleCI trusted publishing via NPM_ID_TOKEN ([c2aafd3](https://github.com/anolilab/semantic-release/commit/c2aafd301b45cdf5f92eef78ff0d461f7e0df0fb))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **semantic-release-pnpm:** allow tarballDir option to be set to false ([a31e1d6](https://github.com/anolilab/semantic-release/commit/a31e1d64b2e8481a73700a3dff64233e14aab91d)), closes [#302](https://github.com/anolilab/semantic-release/issues/302)
|
|
10
|
+
|
|
1
11
|
## @anolilab/semantic-release-pnpm [8.0.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@7.0.0...@anolilab/semantic-release-pnpm@8.0.0) (2026-04-08)
|
|
2
12
|
|
|
3
13
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -128,6 +128,28 @@ id_tokens:
|
|
|
128
128
|
|
|
129
129
|
See the [npm documentation for more details about configuring pipeline details](https://docs.npmjs.com/trusted-publishers#gitlab-cicd-configuration)
|
|
130
130
|
|
|
131
|
+
##### Trusted publishing for CircleCI
|
|
132
|
+
|
|
133
|
+
To use trusted publishing in [CircleCI](https://docs.npmjs.com/trusted-publishers#circleci-configuration) you need to set the environment variable `NPM_ID_TOKEN` to an NPM Identity Token:
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
jobs:
|
|
137
|
+
semantic-release:
|
|
138
|
+
steps:
|
|
139
|
+
# ...
|
|
140
|
+
- run:
|
|
141
|
+
name: Semantic Release with Trusted Publishing via OIDC
|
|
142
|
+
command: |
|
|
143
|
+
# Fetch the OIDC token with the correct audience for npm
|
|
144
|
+
export NPM_ID_TOKEN=$(circleci run oidc get --claims '{"aud": "npm:registry.npmjs.org"}')
|
|
145
|
+
# Run semantic release
|
|
146
|
+
npx semantic-release
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
##### Generic Trusted Publishing
|
|
150
|
+
|
|
151
|
+
The generic mechanism for trusted publishing is to set the `NPM_ID_TOKEN` environment variable to an OIDC identity token. This approach works with any CI platform that has implemented trusted publishing support with npm but does not have specific built-in support in this plugin. If token exchange fails, it will fall back to using token authentication.
|
|
152
|
+
|
|
131
153
|
##### Unsupported CI providers
|
|
132
154
|
|
|
133
155
|
Token authentication is **required** and can be set via [environment variables](#environment-variables).
|
|
@@ -158,9 +180,10 @@ Provenance applies specifically to publishing, so configure it under `publishCon
|
|
|
158
180
|
|
|
159
181
|
### Environment variables
|
|
160
182
|
|
|
161
|
-
| Variable
|
|
162
|
-
|
|
|
163
|
-
| `NPM_TOKEN`
|
|
183
|
+
| Variable | Description |
|
|
184
|
+
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
185
|
+
| `NPM_TOKEN` | Npm token created via [npm token create](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) |
|
|
186
|
+
| `NPM_ID_TOKEN` | OIDC identity token for [trusted publishing](https://docs.npmjs.com/trusted-publishers). Must be configured in your CI job (see [GitLab](#trusted-publishing-for-gitlab-pipelines), [CircleCI](#trusted-publishing-for-circleci)). Takes priority over CI-specific token retrieval when set. |
|
|
164
187
|
|
|
165
188
|
### Options
|
|
166
189
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -58,7 +58,6 @@ const getNpmrcPath = (cwd, environment) => {
|
|
|
58
58
|
|
|
59
59
|
const OFFICIAL_REGISTRY = "https://registry.npmjs.org/";
|
|
60
60
|
const GITHUB_ACTIONS_PROVIDER_NAME = "GitHub Actions";
|
|
61
|
-
const GITLAB_PIPELINES_PROVIDER_NAME = "GitLab CI/CD";
|
|
62
61
|
|
|
63
62
|
const debug$9 = dbg("semantic-release-pnpm:registry");
|
|
64
63
|
const getRegistryUrl = (scope, npmrc) => {
|
|
@@ -299,7 +298,7 @@ Your configuration for the \`publishBranch\` option is \`${String(publishBranch)
|
|
|
299
298
|
},
|
|
300
299
|
EINVALIDTARBALLDIR: ({ tarballDir }) => {
|
|
301
300
|
return {
|
|
302
|
-
details: `The [tarballDir option](${linkify("README.md#tarballdir")}) option, if defined, must be a \`String\`.
|
|
301
|
+
details: `The [tarballDir option](${linkify("README.md#tarballdir")}) option, if defined, must be a \`String\` or \`false\`.
|
|
303
302
|
Your configuration for the \`tarballDir\` option is \`${String(tarballDir)}\`.`,
|
|
304
303
|
message: "Invalid `tarballDir` option."
|
|
305
304
|
};
|
|
@@ -399,37 +398,27 @@ const exchangeGithubActionsToken = async (packageName, context) => {
|
|
|
399
398
|
}
|
|
400
399
|
return exchangeIdToken(idToken, packageName, context);
|
|
401
400
|
};
|
|
402
|
-
const exchangeGitlabPipelinesToken = async (packageName, context) => {
|
|
403
|
-
const idToken = process.env.NPM_ID_TOKEN;
|
|
404
|
-
debug$5("Verifying OIDC context for publishing from GitLab Pipelines");
|
|
405
|
-
if (!idToken) {
|
|
406
|
-
debug$5("NPM_ID_TOKEN environment variable is not set");
|
|
407
|
-
debug$5("Configure trusted publishing in your GitLab project settings and set the NPM_ID_TOKEN variable");
|
|
408
|
-
return void 0;
|
|
409
|
-
}
|
|
410
|
-
return exchangeIdToken(idToken, packageName, context);
|
|
411
|
-
};
|
|
412
401
|
const tokenExchange = (pkg, context) => {
|
|
413
402
|
if (!pkg.name || typeof pkg.name !== "string" || pkg.name.trim() === "") {
|
|
414
403
|
context.logger.error("Invalid package name provided for OIDC token exchange");
|
|
415
404
|
return Promise.resolve(void 0);
|
|
416
405
|
}
|
|
406
|
+
const idToken = process.env.NPM_ID_TOKEN;
|
|
407
|
+
if (idToken) {
|
|
408
|
+
debug$5("NPM_ID_TOKEN environment variable detected, using it for OIDC token exchange");
|
|
409
|
+
return exchangeIdToken(idToken, pkg.name, context);
|
|
410
|
+
}
|
|
417
411
|
const ciEnv = envCi();
|
|
418
412
|
const ciProviderName = typeof ciEnv.name === "string" ? ciEnv.name : void 0;
|
|
419
413
|
if (!ciProviderName) {
|
|
420
414
|
debug$5("Unable to detect CI provider for OIDC token exchange");
|
|
421
|
-
debug$5("Supported CI providers for OIDC trusted publishing: GitHub Actions, GitLab CI/CD");
|
|
422
415
|
return Promise.resolve(void 0);
|
|
423
416
|
}
|
|
424
417
|
debug$5(`Detected CI provider: ${ciProviderName}`);
|
|
425
418
|
if (GITHUB_ACTIONS_PROVIDER_NAME === ciProviderName) {
|
|
426
419
|
return exchangeGithubActionsToken(pkg.name, context);
|
|
427
420
|
}
|
|
428
|
-
|
|
429
|
-
return exchangeGitlabPipelinesToken(pkg.name, context);
|
|
430
|
-
}
|
|
431
|
-
debug$5(`CI provider "${ciProviderName}" is not supported for OIDC trusted publishing`);
|
|
432
|
-
debug$5("Supported CI providers: GitHub Actions, GitLab CI/CD");
|
|
421
|
+
debug$5(`CI provider "${ciProviderName}" does not have built-in OIDC support; set NPM_ID_TOKEN to use trusted publishing`);
|
|
433
422
|
return Promise.resolve(void 0);
|
|
434
423
|
};
|
|
435
424
|
|
|
@@ -685,7 +674,8 @@ const VALIDATORS = {
|
|
|
685
674
|
npmPublish: (value) => typeof value === "boolean",
|
|
686
675
|
pkgRoot: isNonEmptyString,
|
|
687
676
|
publishBranch: isNonEmptyString,
|
|
688
|
-
|
|
677
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
678
|
+
tarballDir: (value) => value === false || isNonEmptyString(value)
|
|
689
679
|
};
|
|
690
680
|
const verifyConfig = (config) => (
|
|
691
681
|
// eslint-disable-next-line unicorn/no-array-reduce
|