-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds command to update release candidates (#421)
- Loading branch information
1 parent
8d186af
commit 36de3ff
Showing
3 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
command: 'update-rc [branch]', | ||
desc: 'Update a release candidate', | ||
builder: { | ||
branch: { | ||
describe: 'Where the latest release branch is', | ||
type: 'string' | ||
}, | ||
distTag: { | ||
describe: 'The dist tag to publish the rc as', | ||
type: 'string', | ||
default: 'next' | ||
}, | ||
preId: { | ||
describe: 'What to call the rc', | ||
type: 'string', | ||
default: 'rc' | ||
} | ||
}, | ||
handler (argv) { | ||
const publishRc = require('../src/update-rc') | ||
const onError = require('../src/error-handler') | ||
publishRc(argv).catch(onError) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict' | ||
|
||
const { | ||
exec | ||
} = require('../utils') | ||
const release = require('../release') | ||
|
||
async function updateRc (opts) { | ||
try { | ||
console.info(`Removing local copy of ${opts.branch}`) // eslint-disable-line no-console | ||
await exec('git', ['branch', '-D', opts.branch]) | ||
} catch (err) { | ||
if (!err.message.includes(`branch '${opts.branch}' not found`)) { | ||
throw err | ||
} | ||
} | ||
|
||
console.info('Fetching repo history') // eslint-disable-line no-console | ||
await exec('git', ['fetch']) | ||
|
||
console.info(`Checking out branch ${opts.branch}`) // eslint-disable-line no-console | ||
await exec('git', ['checkout', opts.branch]) | ||
|
||
console.info(`Removing dependencies`) // eslint-disable-line no-console | ||
await exec('rm', ['-rf', 'node_modules', 'package-lock.json']) | ||
|
||
console.info(`Installing dependencies`) // eslint-disable-line no-console | ||
await exec('npm', ['ci']) | ||
|
||
console.info('Updating', opts.preId) // eslint-disable-line no-console | ||
await release({ | ||
type: `prerelease`, | ||
preid: opts.preId, | ||
'dist-tag': opts.distTag, | ||
build: false, | ||
test: false, | ||
lint: false, | ||
docsFormats: ['html'], | ||
contributors: true, | ||
bump: true, | ||
changelog: true, | ||
publish: true, | ||
ghrelease: true, | ||
docs: true, | ||
ghtoken: opts.ghtoken || process.env.AEGIR_GHTOKEN | ||
}) | ||
|
||
console.info(`Updating branch ${opts.branch}`) // eslint-disable-line no-console | ||
await exec('git', ['push']) | ||
} | ||
|
||
module.exports = updateRc |