29 lines
No EOL
816 B
JavaScript
29 lines
No EOL
816 B
JavaScript
// forked from https://github.com/elk-zone/elk/blob/main/scripts/release.ts
|
|
import {simpleGit } from 'simple-git'
|
|
|
|
const git = simpleGit()
|
|
const hash = await git.revparse(['main'])
|
|
|
|
console.log('Fetch remote gh repo')
|
|
await git.fetch('gh')
|
|
|
|
console.log('Checkout release branch')
|
|
await git.checkout(['-b', 'release', '--track', 'gh/release'])
|
|
|
|
console.log(`Reset to main branch (${hash})`)
|
|
await git.reset(['--hard', hash])
|
|
|
|
console.log('Push to release branch')
|
|
await git.push(['--force', 'gh'])
|
|
|
|
console.log('Checkout main branch')
|
|
await git.checkout('main')
|
|
|
|
console.log('Deleting local release branch')
|
|
await git.branch(['-D', 'release'])
|
|
|
|
// TODO: handle multiple remotes with a data structure
|
|
console.log('Push tags')
|
|
await git.push(['--tags'])
|
|
await git.push(['--tags', 'gh'])
|
|
await git.push(['--tags', 'sh']) |