@ckeditor/ckeditor5-dev-release-tools 46.0.7 → 46.1.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/commitandtag.js +22 -7
- package/package.json +2 -2
|
@@ -17,9 +17,17 @@ const { toUnix } = upath;
|
|
|
17
17
|
* @param {Array.<string>} options.files Array of glob patterns for files to be added to the release commit.
|
|
18
18
|
* @param {string} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
|
|
19
19
|
* @param {boolean} [options.skipCi=true] Whether to add the "[skip ci]" suffix to the commit message.
|
|
20
|
+
* @param {boolean} [options.dryRun=false] When enabled, the function creates a commit to allow executing a pre-commit hook,
|
|
21
|
+
* then removes it using the `git reset` command.
|
|
20
22
|
* @returns {Promise}
|
|
21
23
|
*/
|
|
22
|
-
export default async function commitAndTag( {
|
|
24
|
+
export default async function commitAndTag( {
|
|
25
|
+
version,
|
|
26
|
+
files,
|
|
27
|
+
cwd = process.cwd(),
|
|
28
|
+
skipCi = true,
|
|
29
|
+
dryRun = false
|
|
30
|
+
} ) {
|
|
23
31
|
const normalizedCwd = toUnix( cwd );
|
|
24
32
|
const filePathsToAdd = await glob( files, { cwd: normalizedCwd, absolute: true, nodir: true } );
|
|
25
33
|
|
|
@@ -34,11 +42,18 @@ export default async function commitAndTag( { version, files, cwd = process.cwd(
|
|
|
34
42
|
const { all: availableTags } = await git.tags();
|
|
35
43
|
const tagForVersion = availableTags.find( tag => tag.endsWith( version ) );
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
45
|
+
const makeCommit = () => {
|
|
46
|
+
return git.commit( `Release: v${ version }.${ skipCi ? ' [skip ci]' : '' }`, filePathsToAdd );
|
|
47
|
+
};
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
if ( dryRun ) {
|
|
50
|
+
const lastCommit = await git.log( [ '-1' ] );
|
|
51
|
+
|
|
52
|
+
await makeCommit();
|
|
53
|
+
await git.reset( [ lastCommit.latest.hash ] );
|
|
54
|
+
} else if ( !tagForVersion ) {
|
|
55
|
+
// Commit and create a tag if it does not exist yet. It might happen when a release job is restarted.
|
|
56
|
+
await makeCommit();
|
|
57
|
+
await git.addAnnotatedTag( `v${ version }`, `Release: v${ version }.` );
|
|
58
|
+
}
|
|
44
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-release-tools",
|
|
3
|
-
"version": "46.0
|
|
3
|
+
"version": "46.1.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": "^46.0
|
|
25
|
+
"@ckeditor/ckeditor5-dev-utils": "^46.1.0",
|
|
26
26
|
"@octokit/rest": "^21.0.0",
|
|
27
27
|
"chalk": "^5.0.0",
|
|
28
28
|
"cli-columns": "^4.0.0",
|