chore: move getCurrentBranch to a util file (#15921)
* chore: move getCurrentBranch to a util file * fix import
This commit is contained in:
parent
a1a431eb87
commit
d3c58ea48c
4 changed files with 30 additions and 53 deletions
|
@ -1,22 +1,25 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
if (!process.env.CI) require('dotenv-safe').load()
|
||||
require('colors')
|
||||
const args = require('minimist')(process.argv.slice(2), {
|
||||
boolean: ['automaticRelease', 'notesOnly', 'stable']
|
||||
})
|
||||
const ciReleaseBuild = require('./ci-release-build')
|
||||
const { execSync } = require('child_process')
|
||||
const fail = '\u2717'.red
|
||||
const { GitProcess } = require('dugite')
|
||||
const GitHub = require('github')
|
||||
const pass = '\u2713'.green
|
||||
const { execSync } = require('child_process')
|
||||
const { GitProcess } = require('dugite')
|
||||
|
||||
const path = require('path')
|
||||
const readline = require('readline')
|
||||
const releaseNotesGenerator = require('./release-notes/index.js')
|
||||
const { getCurrentBranch } = require('./lib/utils.js')
|
||||
const versionType = args._[0]
|
||||
const targetRepo = versionType === 'nightly' ? 'nightlies' : 'electron'
|
||||
|
||||
require('colors')
|
||||
const pass = '\u2713'.green
|
||||
const fail = '\u2717'.red
|
||||
|
||||
// TODO (future) automatically determine version based on conventional commits
|
||||
// via conventional-recommended-bump
|
||||
|
||||
|
@ -53,23 +56,6 @@ async function getNewVersion (dryRun) {
|
|||
}
|
||||
}
|
||||
|
||||
async function getCurrentBranch (gitDir) {
|
||||
console.log(`Determining current git branch`)
|
||||
const gitArgs = ['rev-parse', '--abbrev-ref', 'HEAD']
|
||||
const branchDetails = await GitProcess.exec(gitArgs, gitDir)
|
||||
if (branchDetails.exitCode === 0) {
|
||||
const currentBranch = branchDetails.stdout.trim()
|
||||
console.log(`${pass} Successfully determined current git branch is ` +
|
||||
`${currentBranch}`)
|
||||
return currentBranch
|
||||
} else {
|
||||
const error = GitProcess.parseError(branchDetails.stderr)
|
||||
console.log(`${fail} Could not get details for the current branch,
|
||||
error was ${branchDetails.stderr}`, error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
async function getReleaseNotes (currentBranch) {
|
||||
if (versionType === 'nightly') {
|
||||
return 'Nightlies do not get release notes, please compare tags for info'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue