@anolilab/semantic-release-pnpm 3.1.0 → 3.2.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 +15 -0
- package/README.md +7 -0
- package/dist/index.js +128 -37
- package/package.json +19 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## @anolilab/semantic-release-pnpm [3.2.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@3.1.0...@anolilab/semantic-release-pnpm@3.2.0) (2025-12-04)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* enhanced OIDC context handling, added better debug logs ([#239](https://github.com/anolilab/semantic-release/issues/239)) ([2ae7ea5](https://github.com/anolilab/semantic-release/commit/2ae7ea5282d20254b96bbf768c2b1af2e868b6ae))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* enhance package.json keywords across multiple packages ([842cd32](https://github.com/anolilab/semantic-release/commit/842cd32acf48c34d3226b1b2d63e7cdecdeff6b7))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* **@anolilab/rc:** upgraded to 3.2.0
|
|
15
|
+
|
|
1
16
|
## @anolilab/semantic-release-pnpm [3.1.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@3.0.0...@anolilab/semantic-release-pnpm@3.1.0) (2025-11-25)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -74,6 +74,13 @@ When publishing to the [official registry](https://registry.npmjs.org/), it is r
|
|
|
74
74
|
> [!NOTE]
|
|
75
75
|
> When using trusted publishing, provenance attestations are automatically generated for your packages without requiring provenance to be explicitly enabled.
|
|
76
76
|
|
|
77
|
+
> [!IMPORTANT]
|
|
78
|
+
> **First-time releases with OIDC**: npm requires a package to exist before you can configure OIDC trusted publishing. If you're releasing a package for the first time with OIDC, you have two options:
|
|
79
|
+
> 1. Publish a dummy version manually first (e.g., `pnpm publish --tag dummy`), then configure OIDC trusted publishing, and then use semantic-release for subsequent releases.
|
|
80
|
+
> 2. Use the [`setup-npm-trusted-publish`](https://github.com/azu/setup-npm-trusted-publish) tool to automatically create and publish a placeholder package for OIDC setup purposes.
|
|
81
|
+
>
|
|
82
|
+
> 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.
|
|
83
|
+
|
|
77
84
|
##### Trusted publishing from GitHub Actions
|
|
78
85
|
|
|
79
86
|
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
|
@@ -17,6 +17,7 @@ const __cjs_getBuiltinModule = (module) => {
|
|
|
17
17
|
return __cjs_require(module);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
import dbg from 'debug';
|
|
20
21
|
import { execa } from 'execa';
|
|
21
22
|
import { validRange, gte } from 'semver';
|
|
22
23
|
import { isAccessibleSync, ensureFileSync, move, writeFile } from '@visulima/fs';
|
|
@@ -59,6 +60,7 @@ const OFFICIAL_REGISTRY = "https://registry.npmjs.org/";
|
|
|
59
60
|
const GITHUB_ACTIONS_PROVIDER_NAME = "GitHub Actions";
|
|
60
61
|
const GITLAB_PIPELINES_PROVIDER_NAME = "GitLab CI/CD";
|
|
61
62
|
|
|
63
|
+
const debug$9 = dbg("semantic-release-pnpm:registry");
|
|
62
64
|
const getRegistryUrl = (scope, npmrc) => {
|
|
63
65
|
let url = OFFICIAL_REGISTRY;
|
|
64
66
|
if (npmrc) {
|
|
@@ -69,14 +71,35 @@ const getRegistryUrl = (scope, npmrc) => {
|
|
|
69
71
|
}
|
|
70
72
|
return url.endsWith("/") ? url : `${url}/`;
|
|
71
73
|
};
|
|
72
|
-
const getRegistry = ({ name, publishConfig
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const getRegistry = ({ name, publishConfig = {} }, { cwd, env }) => {
|
|
75
|
+
let resolvedRegistry;
|
|
76
|
+
let source;
|
|
77
|
+
const scope = name.split("/")[0];
|
|
78
|
+
const publishRegistry = publishConfig[`${scope}:registry`] ?? publishConfig.registry;
|
|
79
|
+
if (publishRegistry) {
|
|
80
|
+
resolvedRegistry = publishRegistry;
|
|
81
|
+
source = "package.json#publishConfig.registry";
|
|
82
|
+
} else if (env.NPM_CONFIG_REGISTRY) {
|
|
83
|
+
resolvedRegistry = env.NPM_CONFIG_REGISTRY;
|
|
84
|
+
source = "NPM_CONFIG_REGISTRY environment variable";
|
|
85
|
+
} else {
|
|
86
|
+
const npmrcConfig = rc("npm", {
|
|
87
|
+
config: env.NPM_CONFIG_USERCONFIG ?? resolve(cwd, ".npmrc"),
|
|
88
|
+
cwd,
|
|
89
|
+
defaults: { registry: OFFICIAL_REGISTRY }
|
|
90
|
+
});
|
|
91
|
+
const npmrc = npmrcConfig.config;
|
|
92
|
+
resolvedRegistry = getRegistryUrl(scope, npmrc);
|
|
93
|
+
if (npmrc && (npmrc[`${scope}:registry`] ?? npmrc.registry)) {
|
|
94
|
+
source = `.npmrc file (${npmrc[`${scope}:registry`] ? `scoped registry for ${scope}` : "default registry"})`;
|
|
95
|
+
} else {
|
|
96
|
+
source = "default registry (OFFICIAL_REGISTRY)";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const finalRegistry = resolvedRegistry.endsWith("/") ? resolvedRegistry : `${resolvedRegistry}/`;
|
|
100
|
+
debug$9(`Resolved registry "${finalRegistry}" from ${source}`);
|
|
101
|
+
return finalRegistry;
|
|
102
|
+
};
|
|
80
103
|
|
|
81
104
|
const getReleaseInfo = ({ name }, { env: { DEFAULT_NPM_REGISTRY = OFFICIAL_REGISTRY }, nextRelease: { version } }, distributionTag, registry) => {
|
|
82
105
|
return {
|
|
@@ -97,6 +120,7 @@ const reasonToNotPublish = (pluginConfig, package_) => {
|
|
|
97
120
|
};
|
|
98
121
|
const shouldPublish = (pluginConfig, package_) => reasonToNotPublish(pluginConfig, package_) === null;
|
|
99
122
|
|
|
123
|
+
const debug$8 = dbg("semantic-release-pnpm:add-channel");
|
|
100
124
|
const addChannel$1 = async (pluginConfig, packageJson, context) => {
|
|
101
125
|
const {
|
|
102
126
|
cwd,
|
|
@@ -111,7 +135,9 @@ const addChannel$1 = async (pluginConfig, packageJson, context) => {
|
|
|
111
135
|
const distributionTag = getChannel(channel);
|
|
112
136
|
logger.log(`Adding version ${version} to npm registry on dist-tag ${distributionTag}`);
|
|
113
137
|
const npmrc = getNpmrcPath(cwd, env);
|
|
114
|
-
const
|
|
138
|
+
const distTagArguments = ["dist-tag", "add", `${packageJson.name}@${version}`, distributionTag, "--registry", registry];
|
|
139
|
+
debug$8(`Executing: pnpm ${distTagArguments.join(" ")}`);
|
|
140
|
+
const result = execa("pnpm", distTagArguments, {
|
|
115
141
|
cwd,
|
|
116
142
|
env: {
|
|
117
143
|
...env,
|
|
@@ -129,6 +155,7 @@ const addChannel$1 = async (pluginConfig, packageJson, context) => {
|
|
|
129
155
|
return false;
|
|
130
156
|
};
|
|
131
157
|
|
|
158
|
+
const debug$7 = dbg("semantic-release-pnpm:prepare");
|
|
132
159
|
const prepare$1 = async ({ pkgRoot, tarballDir }, { cwd, env, logger, nextRelease: { version }, stderr, stdout }) => {
|
|
133
160
|
const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;
|
|
134
161
|
logger.log("Write version %s to package.json in %s", version, basePath);
|
|
@@ -148,12 +175,17 @@ const prepare$1 = async ({ pkgRoot, tarballDir }, { cwd, env, logger, nextReleas
|
|
|
148
175
|
const tarball = (await packResult).stdout.split("\n").pop();
|
|
149
176
|
const tarballSource = resolve(cwd, tarball);
|
|
150
177
|
const tarballDestination = resolve(cwd, tarballDir.trim(), tarball);
|
|
151
|
-
|
|
178
|
+
debug$7(`Created tarball: ${tarball}`);
|
|
179
|
+
if (tarballSource === tarballDestination) {
|
|
180
|
+
debug$7(`Tarball already at destination: ${tarballDestination}`);
|
|
181
|
+
} else {
|
|
182
|
+
debug$7(`Moving tarball from ${tarballSource} to ${tarballDestination}`);
|
|
152
183
|
await move(tarballSource, tarballDestination);
|
|
153
184
|
}
|
|
154
185
|
}
|
|
155
186
|
};
|
|
156
187
|
|
|
188
|
+
const debug$6 = dbg("semantic-release-pnpm:publish");
|
|
157
189
|
const publish$1 = async (pluginConfig, packageJson, context) => {
|
|
158
190
|
const {
|
|
159
191
|
cwd,
|
|
@@ -181,6 +213,7 @@ const publish$1 = async (pluginConfig, packageJson, context) => {
|
|
|
181
213
|
if (pluginConfig.disableScripts) {
|
|
182
214
|
pnpmArguments.push("--ignore-scripts");
|
|
183
215
|
}
|
|
216
|
+
debug$6(`Executing: pnpm ${pnpmArguments.join(" ")}`);
|
|
184
217
|
const result = execa("pnpm", pnpmArguments, {
|
|
185
218
|
cwd,
|
|
186
219
|
env,
|
|
@@ -329,72 +362,96 @@ const getPackage = async ({ pkgRoot }, { cwd }) => {
|
|
|
329
362
|
}
|
|
330
363
|
};
|
|
331
364
|
|
|
332
|
-
const
|
|
365
|
+
const debug$5 = dbg("semantic-release-pnpm:token-exchange");
|
|
366
|
+
const exchangeIdToken = async (idToken, packageName, context) => {
|
|
333
367
|
const response = await fetch(`${OFFICIAL_REGISTRY}-/npm/v1/oidc/token/exchange/package/${encodeURIComponent(packageName)}`, {
|
|
334
368
|
headers: { Authorization: `Bearer ${idToken}` },
|
|
335
369
|
method: "POST"
|
|
336
370
|
});
|
|
337
371
|
const responseBody = await response.json();
|
|
338
372
|
if (response.ok) {
|
|
339
|
-
|
|
373
|
+
debug$5("OIDC token exchange with the npm registry succeeded");
|
|
340
374
|
return responseBody.token;
|
|
341
375
|
}
|
|
342
|
-
|
|
376
|
+
debug$5(`OIDC token exchange with the npm registry failed: ${response.status} ${responseBody.message}`);
|
|
377
|
+
if (response.status === 404 || responseBody.message?.toLowerCase().includes("not found")) {
|
|
378
|
+
const warningMessage = `Package "${packageName}" does not exist on npm. npm requires a package to exist before you can configure OIDC trusted publishing. You can either publish a dummy version manually first (e.g., \`pnpm publish --tag dummy\`) or use the \`setup-npm-trusted-publish\` tool (https://github.com/azu/setup-npm-trusted-publish) to create a placeholder package. After the package exists, configure OIDC trusted publishing at https://www.npmjs.com/package/${encodeURIComponent(packageName)}/access`;
|
|
379
|
+
context?.logger?.error(warningMessage);
|
|
380
|
+
debug$5(warningMessage);
|
|
381
|
+
}
|
|
343
382
|
return void 0;
|
|
344
383
|
};
|
|
345
|
-
const exchangeGithubActionsToken = async (packageName,
|
|
384
|
+
const exchangeGithubActionsToken = async (packageName, context) => {
|
|
346
385
|
let idToken;
|
|
347
|
-
|
|
386
|
+
debug$5("Verifying OIDC context for publishing from GitHub Actions");
|
|
348
387
|
try {
|
|
349
388
|
idToken = await getIDToken("npm:registry.npmjs.org");
|
|
350
389
|
} catch (error) {
|
|
351
|
-
|
|
352
|
-
|
|
390
|
+
debug$5(`Retrieval of GitHub Actions OIDC token failed: ${error.message}`);
|
|
391
|
+
debug$5("Have you granted the `id-token: write` permission to this workflow?");
|
|
353
392
|
return void 0;
|
|
354
393
|
}
|
|
355
394
|
if (!idToken) {
|
|
356
|
-
|
|
357
|
-
|
|
395
|
+
debug$5("GitHub Actions OIDC token is not available");
|
|
396
|
+
debug$5("Have you granted the `id-token: write` permission to this workflow?");
|
|
358
397
|
return void 0;
|
|
359
398
|
}
|
|
360
|
-
return exchangeIdToken(idToken, packageName,
|
|
399
|
+
return exchangeIdToken(idToken, packageName, context);
|
|
361
400
|
};
|
|
362
|
-
const exchangeGitlabPipelinesToken = async (packageName,
|
|
401
|
+
const exchangeGitlabPipelinesToken = async (packageName, context) => {
|
|
363
402
|
const idToken = process.env.NPM_ID_TOKEN;
|
|
364
|
-
|
|
403
|
+
debug$5("Verifying OIDC context for publishing from GitLab Pipelines");
|
|
365
404
|
if (!idToken) {
|
|
405
|
+
debug$5("NPM_ID_TOKEN environment variable is not set");
|
|
406
|
+
debug$5("Configure trusted publishing in your GitLab project settings and set the NPM_ID_TOKEN variable");
|
|
366
407
|
return void 0;
|
|
367
408
|
}
|
|
368
|
-
return exchangeIdToken(idToken, packageName,
|
|
409
|
+
return exchangeIdToken(idToken, packageName, context);
|
|
369
410
|
};
|
|
370
|
-
const tokenExchange = (pkg,
|
|
411
|
+
const tokenExchange = (pkg, context) => {
|
|
371
412
|
if (!pkg.name || typeof pkg.name !== "string" || pkg.name.trim() === "") {
|
|
372
|
-
logger.
|
|
413
|
+
context.logger.error("Invalid package name provided for OIDC token exchange");
|
|
373
414
|
return Promise.resolve(void 0);
|
|
374
415
|
}
|
|
375
416
|
const ciEnv = envCi();
|
|
376
417
|
const ciProviderName = typeof ciEnv === "object" && ciEnv !== null && typeof ciEnv.name === "string" ? ciEnv.name : void 0;
|
|
377
418
|
if (!ciProviderName) {
|
|
378
|
-
|
|
419
|
+
debug$5("Unable to detect CI provider for OIDC token exchange");
|
|
420
|
+
debug$5("Supported CI providers for OIDC trusted publishing: GitHub Actions, GitLab CI/CD");
|
|
379
421
|
return Promise.resolve(void 0);
|
|
380
422
|
}
|
|
423
|
+
debug$5(`Detected CI provider: ${ciProviderName}`);
|
|
381
424
|
if (GITHUB_ACTIONS_PROVIDER_NAME === ciProviderName) {
|
|
382
|
-
return exchangeGithubActionsToken(pkg.name,
|
|
425
|
+
return exchangeGithubActionsToken(pkg.name, context);
|
|
383
426
|
}
|
|
384
427
|
if (GITLAB_PIPELINES_PROVIDER_NAME === ciProviderName) {
|
|
385
|
-
return exchangeGitlabPipelinesToken(pkg.name,
|
|
428
|
+
return exchangeGitlabPipelinesToken(pkg.name, context);
|
|
386
429
|
}
|
|
430
|
+
debug$5(`CI provider "${ciProviderName}" is not supported for OIDC trusted publishing`);
|
|
431
|
+
debug$5("Supported CI providers: GitHub Actions, GitLab CI/CD");
|
|
387
432
|
return Promise.resolve(void 0);
|
|
388
433
|
};
|
|
389
434
|
|
|
435
|
+
const debug$4 = dbg("semantic-release-pnpm:oidc-context");
|
|
390
436
|
const oidcContext = async (registry, pkg, context) => {
|
|
391
|
-
|
|
437
|
+
const normalizedRegistry = normalizeUrl(registry);
|
|
438
|
+
const normalizedOfficialRegistry = normalizeUrl(OFFICIAL_REGISTRY);
|
|
439
|
+
if (normalizedRegistry !== normalizedOfficialRegistry) {
|
|
440
|
+
debug$4(
|
|
441
|
+
`Registry "${registry}" (normalized: "${normalizedRegistry}") does not match official registry "${OFFICIAL_REGISTRY}" (normalized: "${normalizedOfficialRegistry}"), skipping OIDC check`
|
|
442
|
+
);
|
|
392
443
|
return false;
|
|
393
444
|
}
|
|
445
|
+
debug$4(`Registry matches official npm registry, attempting OIDC token exchange for package "${pkg.name ?? "unknown"}"`);
|
|
394
446
|
try {
|
|
395
447
|
const token = await tokenExchange({ name: pkg.name ?? "" }, context);
|
|
448
|
+
if (!token) {
|
|
449
|
+
debug$4("OIDC token exchange did not succeed, falling back to NPM_TOKEN authentication");
|
|
450
|
+
}
|
|
396
451
|
return !!token;
|
|
397
|
-
} catch {
|
|
452
|
+
} catch (error) {
|
|
453
|
+
debug$4(`OIDC context check failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
454
|
+
debug$4("Falling back to NPM_TOKEN authentication");
|
|
398
455
|
return false;
|
|
399
456
|
}
|
|
400
457
|
};
|
|
@@ -406,6 +463,7 @@ const nerfDart = (url) => {
|
|
|
406
463
|
return `//${real.host}${real.pathname}`;
|
|
407
464
|
};
|
|
408
465
|
|
|
466
|
+
const debug$3 = dbg("semantic-release-pnpm:auth");
|
|
409
467
|
const setNpmrcAuth = async (npmrc, registry, { cwd, env: { NPM_CONFIG_USERCONFIG, NPM_EMAIL, NPM_PASSWORD, NPM_TOKEN, NPM_USERNAME }, logger }) => {
|
|
410
468
|
logger.log("Verify authentication for registry %s", registry);
|
|
411
469
|
const { config, files } = rc("npm", {
|
|
@@ -416,11 +474,14 @@ const setNpmrcAuth = async (npmrc, registry, { cwd, env: { NPM_CONFIG_USERCONFIG
|
|
|
416
474
|
if (Array.isArray(files)) {
|
|
417
475
|
logger.log("Reading npm config from %s", files.join(", "));
|
|
418
476
|
}
|
|
419
|
-
|
|
477
|
+
const existingToken = getAuthToken(registry, { npmrc: config });
|
|
478
|
+
if (existingToken) {
|
|
479
|
+
debug$3(`Using existing authentication token from npmrc files for registry "${registry}"`);
|
|
420
480
|
await writeFile(npmrc, stringify(config));
|
|
421
481
|
return;
|
|
422
482
|
}
|
|
423
483
|
if (NPM_USERNAME && NPM_PASSWORD && NPM_EMAIL) {
|
|
484
|
+
debug$3(`Using username/password/email authentication strategy for registry "${registry}"`);
|
|
424
485
|
await writeFile(
|
|
425
486
|
npmrc,
|
|
426
487
|
`${Object.keys(config).length > 0 ? `${stringify(config)}
|
|
@@ -429,15 +490,18 @@ email = \${NPM_EMAIL}`
|
|
|
429
490
|
);
|
|
430
491
|
logger.log(`Wrote NPM_USERNAME, NPM_PASSWORD, and NPM_EMAIL to ${npmrc}`);
|
|
431
492
|
} else if (NPM_TOKEN) {
|
|
493
|
+
debug$3(`Using NPM_TOKEN authentication strategy for registry "${registry}"`);
|
|
432
494
|
await writeFile(npmrc, `${Object.keys(config).length > 0 ? `${stringify(config)}
|
|
433
495
|
` : ""}${nerfDart(registry)}:_authToken = \${NPM_TOKEN}`);
|
|
434
496
|
logger.log(`Wrote NPM_TOKEN to ${npmrc}`);
|
|
435
497
|
} else {
|
|
498
|
+
debug$3(`No authentication credentials found for registry "${registry}"`);
|
|
436
499
|
const semanticError = getError("ENONPMTOKEN", { registry });
|
|
437
500
|
throw new AggregateError([semanticError], semanticError.message);
|
|
438
501
|
}
|
|
439
502
|
};
|
|
440
503
|
|
|
504
|
+
const debug$2 = dbg("semantic-release-pnpm:verify-auth");
|
|
441
505
|
const isConnectionError = (error) => {
|
|
442
506
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
443
507
|
const errorCode = error?.code || "";
|
|
@@ -526,8 +590,15 @@ const verifyAuthContextAgainstCustomRegistry = async (npmrc, registry, context,
|
|
|
526
590
|
};
|
|
527
591
|
const verifyAuth = async (npmrc, package_, context, pkgRoot) => {
|
|
528
592
|
const registry = getRegistry(package_, context);
|
|
529
|
-
if (package_.name
|
|
530
|
-
|
|
593
|
+
if (package_.name) {
|
|
594
|
+
debug$2(`Checking OIDC trusted publishing for package "${package_.name}" on registry "${registry}"`);
|
|
595
|
+
if (await oidcContext(registry, package_, context)) {
|
|
596
|
+
debug$2("OIDC trusted publishing verified successfully, skipping NPM_TOKEN check");
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
debug$2("OIDC trusted publishing not available, falling back to NPM_TOKEN authentication");
|
|
600
|
+
} else {
|
|
601
|
+
debug$2("Package name not found, skipping OIDC check and using NPM_TOKEN authentication");
|
|
531
602
|
}
|
|
532
603
|
await setNpmrcAuth(npmrc, registry, context);
|
|
533
604
|
const normalizedRegistry = normalizeUrl(registry);
|
|
@@ -567,14 +638,18 @@ const verifyConfig = (config) => (
|
|
|
567
638
|
}, [])
|
|
568
639
|
);
|
|
569
640
|
|
|
641
|
+
const debug$1 = dbg("semantic-release-pnpm:verify-pnpm");
|
|
570
642
|
const MIN_PNPM_VERSION = "8.0.0";
|
|
571
643
|
const verifyPnpm = async ({ logger }) => {
|
|
572
644
|
logger.log(`Verify pnpm version is >= ${MIN_PNPM_VERSION}`);
|
|
573
645
|
const version = getPackageManagerVersion("pnpm");
|
|
646
|
+
debug$1(`Detected pnpm version: ${String(version)}`);
|
|
574
647
|
if (gte(MIN_PNPM_VERSION, version)) {
|
|
648
|
+
debug$1(`pnpm version ${String(version)} is below minimum required version ${MIN_PNPM_VERSION}`);
|
|
575
649
|
const semanticError = getError("EINVALIDPNPM", { version: String(version) });
|
|
576
650
|
throw new AggregateError([semanticError], semanticError.message);
|
|
577
651
|
}
|
|
652
|
+
debug$1(`pnpm version ${String(version)} meets minimum requirement (>= ${MIN_PNPM_VERSION})`);
|
|
578
653
|
};
|
|
579
654
|
|
|
580
655
|
const verify = async (pluginConfig, context) => {
|
|
@@ -590,8 +665,11 @@ const verify = async (pluginConfig, context) => {
|
|
|
590
665
|
try {
|
|
591
666
|
const packageJson = await getPackage(pluginConfig, context);
|
|
592
667
|
if (shouldPublish(pluginConfig, packageJson)) {
|
|
668
|
+
context.logger.log(`Verifying authentication for package "${packageJson.name ?? "unknown"}"`);
|
|
593
669
|
const npmrc = getNpmrcPath(context.cwd, context.env);
|
|
594
670
|
await verifyAuth(npmrc, packageJson, context, pluginConfig.pkgRoot);
|
|
671
|
+
} else {
|
|
672
|
+
context.logger.log(`Skipping authentication verification for package "${packageJson.name ?? "unknown"}" (publishing disabled)`);
|
|
595
673
|
}
|
|
596
674
|
} catch (error) {
|
|
597
675
|
const typedError = error;
|
|
@@ -603,6 +681,7 @@ const verify = async (pluginConfig, context) => {
|
|
|
603
681
|
}
|
|
604
682
|
};
|
|
605
683
|
|
|
684
|
+
const debug = dbg("semantic-release-pnpm:index");
|
|
606
685
|
const PLUGIN_NAME = "semantic-release-pnpm";
|
|
607
686
|
let verified;
|
|
608
687
|
let prepared;
|
|
@@ -620,7 +699,10 @@ const verifyConditions = async (pluginConfig, context) => {
|
|
|
620
699
|
verified = true;
|
|
621
700
|
};
|
|
622
701
|
const prepare = async (pluginConfig, context) => {
|
|
623
|
-
if (
|
|
702
|
+
if (verified) {
|
|
703
|
+
debug("Skipping verifyConditions (already verified)");
|
|
704
|
+
} else {
|
|
705
|
+
debug("Verification not cached, running verifyConditions");
|
|
624
706
|
await verify(pluginConfig, context);
|
|
625
707
|
}
|
|
626
708
|
await prepare$1(pluginConfig, context);
|
|
@@ -628,16 +710,25 @@ const prepare = async (pluginConfig, context) => {
|
|
|
628
710
|
};
|
|
629
711
|
const publish = async (pluginConfig, context) => {
|
|
630
712
|
const packageJson = await getPackage(pluginConfig, context);
|
|
631
|
-
if (
|
|
713
|
+
if (verified) {
|
|
714
|
+
debug("Skipping verifyConditions (already verified)");
|
|
715
|
+
} else {
|
|
716
|
+
debug("Verification not cached, running verifyConditions");
|
|
632
717
|
await verify(pluginConfig, context);
|
|
633
718
|
}
|
|
634
|
-
if (
|
|
719
|
+
if (prepared) {
|
|
720
|
+
debug("Skipping prepare (already prepared)");
|
|
721
|
+
} else {
|
|
722
|
+
debug("Preparation not cached, running prepare");
|
|
635
723
|
await prepare$1(pluginConfig, context);
|
|
636
724
|
}
|
|
637
725
|
return await publish$1(pluginConfig, packageJson, context);
|
|
638
726
|
};
|
|
639
727
|
const addChannel = async (pluginConfig, context) => {
|
|
640
|
-
if (
|
|
728
|
+
if (verified) {
|
|
729
|
+
debug("Skipping verifyConditions (already verified)");
|
|
730
|
+
} else {
|
|
731
|
+
debug("Verification not cached, running verifyConditions");
|
|
641
732
|
await verify(pluginConfig, context);
|
|
642
733
|
}
|
|
643
734
|
const packageJson = await getPackage(pluginConfig, context);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/semantic-release-pnpm",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Semantic-release plugin to publish a npm package with pnpm.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -10,7 +10,21 @@
|
|
|
10
10
|
"monorepo",
|
|
11
11
|
"semantic-release",
|
|
12
12
|
"semantic-release-plugin",
|
|
13
|
-
"semantic-release-pnpm"
|
|
13
|
+
"semantic-release-pnpm",
|
|
14
|
+
"registry",
|
|
15
|
+
"npmjs",
|
|
16
|
+
"npm-registry",
|
|
17
|
+
"package-manager",
|
|
18
|
+
"workspace",
|
|
19
|
+
"workspaces",
|
|
20
|
+
"trusted-publishing",
|
|
21
|
+
"otp",
|
|
22
|
+
"authentication",
|
|
23
|
+
"npm-publish",
|
|
24
|
+
"package-publish",
|
|
25
|
+
"release-plugin",
|
|
26
|
+
"ci-cd",
|
|
27
|
+
"automation"
|
|
14
28
|
],
|
|
15
29
|
"homepage": "https://github.com/anolilab/semantic-release/tree/main/packages/semantic-release-pnpm",
|
|
16
30
|
"bugs": {
|
|
@@ -47,13 +61,14 @@
|
|
|
47
61
|
],
|
|
48
62
|
"dependencies": {
|
|
49
63
|
"@actions/core": "^1.11.1",
|
|
50
|
-
"@anolilab/rc": "3.
|
|
64
|
+
"@anolilab/rc": "3.2.0",
|
|
51
65
|
"@semantic-release/error": "^4.0.0",
|
|
52
66
|
"@visulima/fs": "^4.1.0",
|
|
53
67
|
"@visulima/package": "^4.1.7",
|
|
54
68
|
"@visulima/path": "^2.0.5",
|
|
69
|
+
"debug": "^4.4.3",
|
|
55
70
|
"env-ci": "^11.2.0",
|
|
56
|
-
"execa": "^9.6.
|
|
71
|
+
"execa": "^9.6.1",
|
|
57
72
|
"ini": "^6.0.0",
|
|
58
73
|
"normalize-url": "^8.1.0",
|
|
59
74
|
"registry-auth-token": "^5.1.0",
|