-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrelease.js
More file actions
56 lines (43 loc) · 1.23 KB
/
release.js
File metadata and controls
56 lines (43 loc) · 1.23 KB
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
#!/usr/bin/env node
import fs from 'node:fs'
import { $ } from 'execa'
import {
intro,
outro,
select,
spinner,
cancel,
isCancel,
} from '@clack/prompts'
import pico from 'picocolors'
import { inc } from 'semver'
const currentVersion = JSON.parse(
fs.readFileSync('./package.json', 'utf-8'),
).version
intro(`Releasing ${pico.underline(pico.green('install-vue'))}`)
const newVersion = await select({
message: 'What kind of release?',
options: ['patch', 'minor', 'major'].map((releaseType) => {
const afterIncrement = inc(currentVersion, releaseType)
return {
value: afterIncrement,
label: releaseType,
hint: `v${currentVersion} -> v${afterIncrement}`,
}
}),
})
if (isCancel(newVersion)) {
cancel('Operation cancelled.')
process.exit(0)
}
const s = spinner()
s.start(`Tagging v${newVersion}`)
await $`pnpm version ${newVersion}`
s.stop(`Tagged v${newVersion}`)
const pushSpinner = spinner()
pushSpinner.start('Pushing to GitHub...')
await $`git push origin main --follow-tags`
pushSpinner.stop('Pushed to GitHub')
outro(`Done! The release workflow will be triggered automatically.
Check the GitHub Actions tab for the publishing progress:
https://github.com/haoqunjiang/install-vue/actions`)