chore: refactor the release script
This commit is contained in:
parent
2038badb13
commit
21bfce4c04
1 changed files with 4 additions and 3 deletions
|
|
@ -3,9 +3,10 @@ import { simpleGit } from 'simple-git'
|
||||||
|
|
||||||
const git = simpleGit()
|
const git = simpleGit()
|
||||||
const hash = await git.revparse(['main'])
|
const hash = await git.revparse(['main'])
|
||||||
|
const remote = 'gh'
|
||||||
|
|
||||||
console.log('Fetch remote gh repo')
|
console.log('Fetch remote gh repo')
|
||||||
await git.fetch('gh')
|
await git.fetch(remote)
|
||||||
|
|
||||||
console.log('Checkout release branch')
|
console.log('Checkout release branch')
|
||||||
await git.checkout(['-b', 'release', '--track', 'gh/release'])
|
await git.checkout(['-b', 'release', '--track', 'gh/release'])
|
||||||
|
|
@ -14,7 +15,7 @@ console.log(`Reset to main branch (${hash})`)
|
||||||
await git.reset(['--hard', hash])
|
await git.reset(['--hard', hash])
|
||||||
|
|
||||||
console.log('Push to release branch')
|
console.log('Push to release branch')
|
||||||
await git.push(['--force', 'gh'])
|
await git.push(['--force', remote])
|
||||||
|
|
||||||
console.log('Checkout main branch')
|
console.log('Checkout main branch')
|
||||||
await git.checkout('main')
|
await git.checkout('main')
|
||||||
|
|
@ -25,5 +26,5 @@ await git.branch(['-D', 'release'])
|
||||||
// TODO: handle multiple remotes with a data structure
|
// TODO: handle multiple remotes with a data structure
|
||||||
console.log('Push tags')
|
console.log('Push tags')
|
||||||
await git.push(['--tags'])
|
await git.push(['--tags'])
|
||||||
await git.push(['--tags', 'gh'])
|
await git.push(['--tags', remote])
|
||||||
await git.push(['--tags', 'sh'])
|
await git.push(['--tags', 'sh'])
|
||||||
Loading…
Reference in a new issue