@anolilab/semantic-release-pnpm 3.2.1 → 3.2.2
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 +6 -0
- package/README.md +4 -1
- package/dist/index.js +18 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## @anolilab/semantic-release-pnpm [3.2.2](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@3.2.1...@anolilab/semantic-release-pnpm@3.2.2) (2025-12-05)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* enhance OIDC authentication handling in verifyAuth ([0141c07](https://github.com/anolilab/semantic-release/commit/0141c07cc4a0457b4aa01ecade582c40d17ef205))
|
|
6
|
+
|
|
1
7
|
## @anolilab/semantic-release-pnpm [3.2.1](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@3.2.0...@anolilab/semantic-release-pnpm@3.2.1) (2025-12-05)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
|
|
|
53
53
|
|
|
54
54
|
| Step | Description |
|
|
55
55
|
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
56
|
-
| `verifyConditions` | Verify the presence of the `NPM_TOKEN` environment variable, or an `.npmrc` file, and verify the authentication method is valid. |
|
|
56
|
+
| `verifyConditions` | Verify the presence of the `NPM_TOKEN` environment variable, or an `.npmrc` file, and verify the authentication method is valid. Results are cached per registry/auth combination to prevent throttling in monorepos. |
|
|
57
57
|
| `prepare` | Update the `package.json` version and [create](https://docs.npmjs.com/cli/pack) the npm package tarball. |
|
|
58
58
|
| `addChannel` | [Add a release to a dist-tag](https://docs.npmjs.com/cli/dist-tag). |
|
|
59
59
|
| `publish` | [Publish the npm package](https://docs.npmjs.com/cli/publish) to the registry. |
|
|
@@ -82,6 +82,9 @@ When publishing to the [official registry](https://registry.npmjs.org/), it is r
|
|
|
82
82
|
>
|
|
83
83
|
> After the initial package exists, you can configure OIDC trusted publishing at `https://www.npmjs.com/package/<package-name>/access` and then use semantic-release for all future releases.
|
|
84
84
|
|
|
85
|
+
> [!TIP]
|
|
86
|
+
> **Monorepo Performance**: The plugin automatically caches authentication verification results per registry/auth token combination. This prevents throttling when verifying multiple packages in monorepos, as `pnpm whoami` is only called once per unique registry/authentication context rather than once per package.
|
|
87
|
+
|
|
85
88
|
##### Trusted publishing from GitHub Actions
|
|
86
89
|
|
|
87
90
|
To leverage trusted publishing and publish with provenance from GitHub Actions, the `id-token: write` permission is required to be enabled on the job:
|
package/dist/index.js
CHANGED
|
@@ -26,10 +26,10 @@ import { rc } from '@anolilab/rc';
|
|
|
26
26
|
import normalizeUrl from 'normalize-url';
|
|
27
27
|
import { findPackageJson, getPackageManagerVersion } from '@visulima/package';
|
|
28
28
|
import SemanticReleaseError from '@semantic-release/error';
|
|
29
|
+
import { stringify } from 'ini';
|
|
29
30
|
import getAuthToken from 'registry-auth-token';
|
|
30
31
|
import { getIDToken } from '@actions/core';
|
|
31
32
|
import envCi from 'env-ci';
|
|
32
|
-
import { stringify } from 'ini';
|
|
33
33
|
const {
|
|
34
34
|
URL
|
|
35
35
|
} = __cjs_getBuiltinModule("node:url");
|
|
@@ -644,10 +644,24 @@ const verifyAuth = async (npmrc, package_, context, pkgRoot) => {
|
|
|
644
644
|
if (package_.name) {
|
|
645
645
|
debug$2(`Checking OIDC trusted publishing for package "${package_.name}" on registry "${registry}"`);
|
|
646
646
|
if (await oidcContext(registry, package_, context)) {
|
|
647
|
-
debug$2("OIDC trusted publishing verified successfully,
|
|
648
|
-
|
|
647
|
+
debug$2("OIDC trusted publishing verified successfully, exchanging token for npmrc");
|
|
648
|
+
const oidcToken = await tokenExchange({ name: package_.name }, context);
|
|
649
|
+
if (oidcToken) {
|
|
650
|
+
const { config } = rc("npm", {
|
|
651
|
+
config: context.env.NPM_CONFIG_USERCONFIG ?? resolve(context.cwd, ".npmrc"),
|
|
652
|
+
cwd: context.cwd,
|
|
653
|
+
defaults: { registry: OFFICIAL_REGISTRY }
|
|
654
|
+
});
|
|
655
|
+
await writeFile(npmrc, `${Object.keys(config).length > 0 ? `${stringify(config)}
|
|
656
|
+
` : ""}${nerfDart(registry)}:_authToken = ${oidcToken}`);
|
|
657
|
+
debug$2(`Wrote OIDC-exchanged token to ${npmrc} for use during publish`);
|
|
658
|
+
context.logger.log(`OIDC trusted publishing configured for package "${package_.name}"`);
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
debug$2("OIDC token exchange failed, falling back to NPM_TOKEN authentication");
|
|
662
|
+
} else {
|
|
663
|
+
debug$2("OIDC trusted publishing not available, falling back to NPM_TOKEN authentication");
|
|
649
664
|
}
|
|
650
|
-
debug$2("OIDC trusted publishing not available, falling back to NPM_TOKEN authentication");
|
|
651
665
|
} else {
|
|
652
666
|
debug$2("Package name not found, skipping OIDC check and using NPM_TOKEN authentication");
|
|
653
667
|
}
|