@ckeditor/ckeditor5-dev-release-tools 62.1.0 → 62.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.
|
@@ -79,15 +79,7 @@ export default async function publishPackages( options ) {
|
|
|
79
79
|
attempts = 5
|
|
80
80
|
} = options;
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
// npm exchanges the OIDC token only during supported operations, such as `npm publish`, and `npm whoami`
|
|
84
|
-
// does not reflect Trusted Publishing authentication. Hence, only the token presence can be verified upfront.
|
|
85
|
-
if ( !process.env.NPM_ID_TOKEN ) {
|
|
86
|
-
throw new Error( 'The "NPM_ID_TOKEN" environment variable is required when publishing using npm Trusted Publishing (OIDC).' );
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
await assertNpmAuthorization( npmOwner );
|
|
90
|
-
}
|
|
82
|
+
await assertNpmAuthorization( npmOwner, { useOidc } );
|
|
91
83
|
|
|
92
84
|
// Find packages that would be published...
|
|
93
85
|
const packagePaths = await workspaces.findPathsToPackages( cwd, packagesDirectory );
|
|
@@ -19,8 +19,14 @@ const execPromise = promisify( exec );
|
|
|
19
19
|
* It supports built-in tags (e.g. `latest`, `staging`, `next`) and custom tags (e.g. `latest-v{X}`).
|
|
20
20
|
* Each operation will be retried up to 3 times in case of failure.
|
|
21
21
|
*
|
|
22
|
+
* When using npm Trusted Publishing (`useOidc`), the `npm whoami` check is replaced by verifying that the `NPM_ID_TOKEN`
|
|
23
|
+
* environment variable is set, as `npm whoami` does not reflect OIDC authentication. It requires npm 11.21.0 or newer
|
|
24
|
+
* and a trusted publisher that allows the `npm dist-tag` command.
|
|
25
|
+
*
|
|
22
26
|
* @param {object} options
|
|
23
|
-
* @param {string} options.npmOwner User that is authorized to release packages.
|
|
27
|
+
* @param {string} [options.npmOwner] User that is authorized to release packages. Required unless `useOidc` is enabled.
|
|
28
|
+
* @param {boolean} [options.useOidc=false] Whether to authorize using npm Trusted Publishing (OIDC). When enabled,
|
|
29
|
+
* the `npm whoami` authorization check is skipped and the `NPM_ID_TOKEN` environment variable must be set instead.
|
|
24
30
|
* @param {string} options.version Specifies the version of packages to reassign the tags for.
|
|
25
31
|
* @param {Array.<string>} options.packages Array of packages' names to reassign tags for.
|
|
26
32
|
* @param {string} [options.npmTag='latest'] Npm dist-tag to assign.
|
|
@@ -29,6 +35,7 @@ const execPromise = promisify( exec );
|
|
|
29
35
|
export default async function reassignNpmTags( options ) {
|
|
30
36
|
const {
|
|
31
37
|
npmOwner,
|
|
38
|
+
useOidc = false,
|
|
32
39
|
version,
|
|
33
40
|
packages,
|
|
34
41
|
npmTag = 'latest'
|
|
@@ -38,7 +45,7 @@ export default async function reassignNpmTags( options ) {
|
|
|
38
45
|
const packagesSkipped = [];
|
|
39
46
|
const packagesUpdated = [];
|
|
40
47
|
|
|
41
|
-
await assertNpmAuthorization( npmOwner );
|
|
48
|
+
await assertNpmAuthorization( npmOwner, { useOidc } );
|
|
42
49
|
|
|
43
50
|
const counter = tools.createSpinner( 'Reassigning npm tags...', { total: packages.length } );
|
|
44
51
|
counter.start();
|
|
@@ -8,10 +8,25 @@ import { tools } from '@ckeditor/ckeditor5-dev-utils';
|
|
|
8
8
|
/**
|
|
9
9
|
* Checks whether a user is logged to npm as the provided account name.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* When using npm Trusted Publishing (`useOidc`), the check verifies that the `NPM_ID_TOKEN` environment variable is set
|
|
12
|
+
* instead. npm exchanges the OIDC token only during supported operations, such as `npm publish` or `npm dist-tag`,
|
|
13
|
+
* and `npm whoami` does not reflect Trusted Publishing authentication.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} [npmOwner] Expected npm account name that should be logged into npm. Required unless `useOidc` is enabled.
|
|
16
|
+
* @param {object} [options={}]
|
|
17
|
+
* @param {boolean} [options.useOidc=false] Whether to verify the npm Trusted Publishing (OIDC) setup instead of the npm account.
|
|
12
18
|
* @returns {Promise}
|
|
13
19
|
*/
|
|
14
|
-
export default async function assertNpmAuthorization( npmOwner ) {
|
|
20
|
+
export default async function assertNpmAuthorization( npmOwner, { useOidc = false } = {} ) {
|
|
21
|
+
if ( useOidc ) {
|
|
22
|
+
// Only the token presence can be verified upfront.
|
|
23
|
+
if ( !process.env.NPM_ID_TOKEN ) {
|
|
24
|
+
throw new Error( 'The "NPM_ID_TOKEN" environment variable is required when using npm Trusted Publishing (OIDC).' );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
15
30
|
return tools.shExec( 'npm whoami', { verbosity: 'error', async: true } )
|
|
16
31
|
.then( npmCurrentUser => {
|
|
17
32
|
if ( npmOwner !== npmCurrentUser.trim() ) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-release-tools",
|
|
3
|
-
"version": "62.
|
|
3
|
+
"version": "62.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": "^62.
|
|
25
|
+
"@ckeditor/ckeditor5-dev-utils": "^62.2.0",
|
|
26
26
|
"@octokit/rest": "^22.0.1",
|
|
27
27
|
"cli-columns": "^4.0.0",
|
|
28
28
|
"glob": "^13.0.6",
|