-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internal: Aligned release tools to the latest CKEditor 5 dev. Closes #…
…159.
- Loading branch information
Showing
8 changed files
with
937 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
coverage/ | ||
node_modules/ | ||
.idea | ||
|
||
# Prepared files to publish to npm. | ||
/release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
|
||
const { Listr } = require( 'listr2' ); | ||
const releaseTools = require( '@ckeditor/ckeditor5-dev-release-tools' ); | ||
|
||
const latestVersion = releaseTools.getLastFromChangelog(); | ||
const versionChangelog = releaseTools.getChangesForVersion( latestVersion ); | ||
|
||
const tasks = new Listr( [ | ||
{ | ||
title: 'Verifying the repository.', | ||
task: async () => { | ||
const errors = await releaseTools.validateRepositoryToRelease( { | ||
version: latestVersion, | ||
changes: versionChangelog, | ||
branch: 'master' | ||
} ); | ||
|
||
if ( !errors.length ) { | ||
return; | ||
} | ||
|
||
return Promise.reject( 'Aborted due to errors.\n' + errors.map( message => `* ${ message }` ).join( '\n' ) ); | ||
} | ||
}, | ||
{ | ||
title: 'Updating the `#version` field.', | ||
task: () => { | ||
return releaseTools.updateVersions( { | ||
version: latestVersion | ||
} ); | ||
} | ||
}, | ||
{ | ||
title: 'Creating the `mrgit2` package in the release directory.', | ||
task: () => { | ||
return releaseTools.prepareRepository( { | ||
outputDirectory: 'release', | ||
rootPackageJson: require( '../package.json' ) | ||
} ); | ||
} | ||
}, | ||
{ | ||
title: 'Cleaning-up.', | ||
task: () => { | ||
return releaseTools.cleanUpPackages( { | ||
packagesDirectory: 'release' | ||
} ); | ||
} | ||
}, | ||
{ | ||
title: 'Commit & tag.', | ||
task: () => { | ||
return releaseTools.commitAndTag( { | ||
version: latestVersion, | ||
files: [ | ||
'package.json' | ||
] | ||
} ); | ||
} | ||
} | ||
] ); | ||
|
||
tasks.run() | ||
.catch( err => { | ||
process.exitCode = 1; | ||
|
||
console.log( '' ); | ||
console.error( err ); | ||
} ); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
|
||
const { Listr } = require( 'listr2' ); | ||
const releaseTools = require( '@ckeditor/ckeditor5-dev-release-tools' ); | ||
const { provideToken } = require( '@ckeditor/ckeditor5-dev-release-tools/lib/utils/cli' ); | ||
const parseArguments = require( './utils/parsearguments' ); | ||
|
||
const cliArguments = parseArguments( process.argv.slice( 2 ) ); | ||
const latestVersion = releaseTools.getLastFromChangelog(); | ||
const versionChangelog = releaseTools.getChangesForVersion( latestVersion ); | ||
|
||
let githubToken; | ||
|
||
const tasks = new Listr( [ | ||
{ | ||
title: 'Publishing packages.', | ||
task: async ( _, task ) => { | ||
return releaseTools.publishPackages( { | ||
packagesDirectory: 'release', | ||
npmOwner: 'cksource', | ||
npmTag: cliArguments.npmTag, | ||
listrTask: task, | ||
confirmationCallback: () => { | ||
return task.prompt( { type: 'Confirm', message: 'Do you want to continue?' } ); | ||
} | ||
} ); | ||
}, | ||
retry: 3 | ||
}, | ||
{ | ||
title: 'Creating the release page.', | ||
task: async ( _, task ) => { | ||
const releaseUrl = await releaseTools.createGithubRelease( { | ||
token: githubToken, | ||
version: latestVersion, | ||
description: versionChangelog | ||
} ); | ||
|
||
task.output = `Release page: ${ releaseUrl }`; | ||
} | ||
}, | ||
{ | ||
title: 'Pushing changes.', | ||
task: () => { | ||
return releaseTools.push( { | ||
releaseBranch: 'master', | ||
version: latestVersion | ||
} ); | ||
} | ||
} | ||
] ); | ||
|
||
( async () => { | ||
try { | ||
githubToken = await provideToken(); | ||
|
||
await tasks.run(); | ||
} catch ( err ) { | ||
console.error( err ); | ||
} | ||
} )(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
|
||
const minimist = require( 'minimist' ); | ||
|
||
/** | ||
* @param {Array.<String>} cliArguments | ||
* @returns {ReleaseOptions} options | ||
*/ | ||
module.exports = function parseArguments( cliArguments ) { | ||
const config = { | ||
string: [ | ||
'npm-tag' | ||
], | ||
|
||
default: { | ||
'npm-tag': 'latest' | ||
} | ||
}; | ||
|
||
const options = minimist( cliArguments, config ); | ||
|
||
options.npmTag = options[ 'npm-tag' ]; | ||
delete options[ 'npm-tag' ]; | ||
|
||
return options; | ||
}; | ||
|
||
/** | ||
* @typedef {Object} ReleaseOptions | ||
* | ||
* @property {Array.<String>|null} packages | ||
*/ |
Oops, something went wrong.