-
Notifications
You must be signed in to change notification settings - Fork 115
git-node: add git-node-release #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4e6da65
git-node: add git-node-release
codebytere 8a3bb80
feat: verify Releaser status
codebytere 7318bab
Address review feedback
codebytere cfda042
Add notables to commmit msg body
codebytere f09a47c
refactor: address review comments
codebytere 09d5c0b
fix: update for new cli.prompt
codebytere ee51222
Create proposal branch automatically
codebytere f9c8cbb
Address some feedback from @mylesborins
codebytere 7e8f11a
Automatically calculate version based on commits
codebytere 15bbc23
fix: create release commit w/o markdown
codebytere 6cda82a
fix: use changelog to determine new version
codebytere c0693d7
fix: use Current branch instead of master for LTS comparison
codebytere 66d6a06
Move initial branchDiff to prepare
codebytere 079b860
Remove push/pr automation
codebytere 30dbaa8
Fix accidental splice removal
codebytere be4c952
Add changelog-maker dep per @rvagg feedback
codebytere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,91 @@ | ||
'use strict'; | ||
|
||
const yargs = require('yargs'); | ||
|
||
const CLI = require('../../lib/cli'); | ||
const ReleasePreparation = require('../../lib/prepare_release'); | ||
const { runPromise } = require('../../lib/run'); | ||
|
||
const PREPARE = 'prepare'; | ||
const PROMOTE = 'promote'; | ||
|
||
const releaseOptions = { | ||
prepare: { | ||
describe: 'Prepare a new release of Node.js', | ||
type: 'boolean' | ||
}, | ||
promote: { | ||
describe: 'Promote new release of Node.js', | ||
type: 'boolean' | ||
}, | ||
security: { | ||
describe: 'Demarcate the new security release as a security release', | ||
type: 'boolean' | ||
} | ||
}; | ||
|
||
function builder(yargs) { | ||
return yargs | ||
.options(releaseOptions).positional('newVersion', { | ||
describe: 'Version number of the release to be prepared or promoted' | ||
}) | ||
.example('git node release --prepare 1.2.3', | ||
'Prepare a new release of Node.js tagged v1.2.3'); | ||
} | ||
|
||
function handler(argv) { | ||
if (argv.prepare) { | ||
return release(PREPARE, argv); | ||
} else if (argv.promote) { | ||
return release(PROMOTE, argv); | ||
} | ||
|
||
// If more than one action is provided or no valid action | ||
// is provided, show help. | ||
yargs.showHelp(); | ||
} | ||
|
||
function release(state, argv) { | ||
const logStream = process.stdout.isTTY ? process.stdout : process.stderr; | ||
const cli = new CLI(logStream); | ||
const dir = process.cwd(); | ||
|
||
return runPromise(main(state, argv, cli, dir)).catch((err) => { | ||
if (cli.spinner.enabled) { | ||
cli.spinner.fail(); | ||
} | ||
throw err; | ||
}); | ||
} | ||
|
||
module.exports = { | ||
command: 'release [newVersion|options]', | ||
describe: | ||
'Manage an in-progress release or start a new one.', | ||
builder, | ||
handler | ||
}; | ||
|
||
async function main(state, argv, cli, dir) { | ||
if (state === PREPARE) { | ||
const prep = new ReleasePreparation(argv, cli, dir); | ||
|
||
if (prep.warnForWrongBranch()) return; | ||
|
||
// If the new version was automatically calculated, confirm it. | ||
if (!argv.newVersion) { | ||
const create = await cli.prompt( | ||
`Create release with new version ${prep.newVersion}?`, | ||
{ defaultAnswer: true }); | ||
|
||
if (!create) { | ||
cli.error('Aborting release preparation process'); | ||
return; | ||
} | ||
} | ||
|
||
return prep.prepare(); | ||
} else if (state === PROMOTE) { | ||
// TODO(codebytere): implement release promotion. | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.