@ckeditor/ckeditor5-dev-release-tools 57.0.0 → 57.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/lib/tasks/publishpackages.js +17 -3
- package/package.json +2 -2
|
@@ -19,7 +19,9 @@ import { workspaces, npm } from '@ckeditor/ckeditor5-dev-utils';
|
|
|
19
19
|
*
|
|
20
20
|
* The validation contains the following steps:
|
|
21
21
|
*
|
|
22
|
-
* - A user (a CLI session) must be logged to npm on the specified account (`npmOwner`).
|
|
22
|
+
* - A user (a CLI session) must be logged to npm on the specified account (`npmOwner`). When publishing via npm Trusted Publishing
|
|
23
|
+
* (`useOidc`), this check is replaced by verifying that the `NPM_ID_TOKEN` environment variable is set, as `npm whoami` does not
|
|
24
|
+
* reflect OIDC authentication.
|
|
23
25
|
* - A package directory must contain `package.json` file.
|
|
24
26
|
* - All files defined in the `optionalEntryPointPackages` option must exist in a package directory.
|
|
25
27
|
* - An npm tag (dist-tag) must match the tag calculated from the package version.
|
|
@@ -33,7 +35,10 @@ import { workspaces, npm } from '@ckeditor/ckeditor5-dev-utils';
|
|
|
33
35
|
*
|
|
34
36
|
* @param {object} options
|
|
35
37
|
* @param {string} options.packagesDirectory Relative path to a location of packages to release.
|
|
36
|
-
* @param {string} options.npmOwner The account name on npm, which should be used to publish the packages.
|
|
38
|
+
* @param {string} [options.npmOwner] The account name on npm, which should be used to publish the packages.
|
|
39
|
+
* Required unless `useOidc` is enabled.
|
|
40
|
+
* @param {boolean} [options.useOidc=false] Whether to publish packages using npm Trusted Publishing (OIDC). When enabled,
|
|
41
|
+
* the `npm whoami` authorization check is skipped and the `NPM_ID_TOKEN` environment variable must be set instead.
|
|
37
42
|
* @param {ListrTaskObject} [options.listrTask] An instance of `ListrTask`.
|
|
38
43
|
* @param {AbortSignal|null} [options.signal=null] Signal to abort the asynchronous process.
|
|
39
44
|
* @param {string} [options.npmTag='staging'] The npm distribution tag.
|
|
@@ -57,6 +62,7 @@ export default async function publishPackages( options ) {
|
|
|
57
62
|
const {
|
|
58
63
|
packagesDirectory,
|
|
59
64
|
npmOwner,
|
|
65
|
+
useOidc = false,
|
|
60
66
|
listrTask,
|
|
61
67
|
signal = null,
|
|
62
68
|
npmTag = 'staging',
|
|
@@ -70,7 +76,15 @@ export default async function publishPackages( options ) {
|
|
|
70
76
|
attempts = 5
|
|
71
77
|
} = options;
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
if ( useOidc ) {
|
|
80
|
+
// npm exchanges the OIDC token only during supported operations, such as `npm publish`, and `npm whoami`
|
|
81
|
+
// does not reflect Trusted Publishing authentication. Hence, only the token presence can be verified upfront.
|
|
82
|
+
if ( !process.env.NPM_ID_TOKEN ) {
|
|
83
|
+
throw new Error( 'The "NPM_ID_TOKEN" environment variable is required when publishing using npm Trusted Publishing (OIDC).' );
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
await assertNpmAuthorization( npmOwner );
|
|
87
|
+
}
|
|
74
88
|
|
|
75
89
|
// Find packages that would be published...
|
|
76
90
|
const packagePaths = await workspaces.findPathsToPackages( cwd, packagesDirectory );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-release-tools",
|
|
3
|
-
"version": "57.
|
|
3
|
+
"version": "57.2.0",
|
|
4
4
|
"description": "Tools used for releasing CKEditor 5 and related packages.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"lib"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ckeditor/ckeditor5-dev-utils": "^57.
|
|
25
|
+
"@ckeditor/ckeditor5-dev-utils": "^57.2.0",
|
|
26
26
|
"@octokit/rest": "^22.0.1",
|
|
27
27
|
"cli-columns": "^4.0.0",
|
|
28
28
|
"glob": "^13.0.6",
|