-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
release-patch.ts
51 lines (41 loc) · 1.45 KB
/
release-patch.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* -----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/
/**
* Inspired by: https://github.com/jupyterlab/jupyterlab/blob/master/buildutils/src/patch-release.ts
*/
import * as utils from '@jupyterlab/buildutils';
import commander from 'commander';
import { getPythonVersion, postbump } from './utils';
// Specify the program signature.
commander
.description('Create a patch release')
.option('--force', 'Force the upgrade')
.option('--skip-commit', 'Whether to skip commit changes')
.action((options: any) => {
// Make sure we can patch release.
const pyVersion = getPythonVersion();
if (
pyVersion.includes('a') ||
pyVersion.includes('b') ||
pyVersion.includes('rc')
) {
throw new Error('Can only make a patch release from a final version');
}
// Run pre-bump actions.
utils.prebump();
// Patch the python version
utils.run('hatch version patch');
// Version the changed
let cmd =
'jlpm run lerna version patch --no-push --force-publish --no-git-tag-version';
if (options.force) {
cmd += ' --yes';
}
utils.run(cmd);
// Whether to commit after bumping
const commit = options.skipCommit !== true;
postbump(commit);
});
commander.parse(process.argv);