File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { $ } from "execa" ;
2
+ import { readFile } from "node:fs/promises" ;
2
3
import newGithubReleaseUrl from "new-github-release-url" ;
3
4
import open from "open" ;
5
+ import { SemVer } from "semver" ;
4
6
5
7
const $$ = $ ( { stdio : "inherit" } ) ;
6
8
@@ -13,18 +15,27 @@ if (await hasChanges()) {
13
15
14
16
await $$ `npm run build` ;
15
17
await $$ `npm run version` ;
18
+ const pkg = JSON . parse ( await readFile ( "package.json" , "utf8" ) ) ;
16
19
await $$ `npm install` ;
17
20
await $$ `git commit -a -m ${ "chore: update versions" } ` ;
21
+ await $$ `git tag v${ pkg . version } ` ;
18
22
await $$ `git push` ;
19
23
await $$ `npm publish` ;
20
24
21
25
const url = newGithubReleaseUrl ( {
22
26
user : "tscpp" ,
23
27
repo : "conventional-versioning" ,
28
+ tag : `v${ pkg . version } ` ,
29
+ isPrerelease : isPreRelease ( pkg . version ) ,
24
30
} ) ;
25
31
await open ( url ) ;
26
32
27
33
async function hasChanges ( ) {
28
34
const { stdout } = await $ `git status --porcelain` ;
29
35
return stdout . trim ( ) !== "" ;
30
36
}
37
+
38
+ function isPreRelease ( version ) {
39
+ version = new SemVer ( version ) ;
40
+ return version . prerelease . length > 0 ;
41
+ }
You can’t perform that action at this time.
0 commit comments