-
-
Notifications
You must be signed in to change notification settings - Fork 243
/
Copy pathrelease.ts
57 lines (52 loc) · 1.6 KB
/
release.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
52
53
54
55
56
57
import { execSync } from 'node:child_process';
import { releaseChangelog, releaseVersion } from 'nx/src/command-line/release';
import yargs from 'yargs';
(async () => {
try {
const options = await yargs
.version(false)
.option('version', {
description:
'Explicit version specifier to use, if overriding conventional commits',
type: 'string',
})
.option('dryRun', {
alias: 'd',
description:
'Whether or not to perform a dry-run of the release process, defaults to true',
type: 'boolean',
default: true,
})
.option('verbose', {
description:
'Whether or not to enable verbose logging, defaults to false',
type: 'boolean',
default: false,
})
.parseAsync();
// Prepare the packages for publishing
execSync('pnpm build', {
stdio: 'inherit',
maxBuffer: 1024 * 1000000,
});
const { workspaceVersion, projectsVersionData } = await releaseVersion({
specifier: options.version,
// stage package.json updates to be committed later by the changelog command
stageChanges: true,
dryRun: options.dryRun,
verbose: options.verbose,
});
// This will create a release on GitHub, which will act as a trigger for the publish.yml workflow
await releaseChangelog({
versionData: projectsVersionData,
version: workspaceVersion,
interactive: 'workspace',
dryRun: options.dryRun,
verbose: options.verbose,
});
process.exit(0);
} catch (err) {
console.error(err);
process.exit(1);
}
})();