diff --git a/README.md b/README.md index df11c2a0..0be18264 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,8 @@ $ conventional-github-releaser --help # for more details You can supply your auth token by a flag `-t` or `--token`. You can also set up an environment variable `CONVENTIONAL_GITHUB_RELEASER_TOKEN` to avoid typing your token every time. +You can also submit your release as a draft version via the '--draft' flag. This allows you to review the and edit the release notes before an official release. + Note: If all results error, it will print the error messages to stderr and exit with code `1`. diff --git a/cli.js b/cli.js index 7ed01917..b42194a2 100755 --- a/cli.js +++ b/cli.js @@ -31,7 +31,10 @@ var cli = meow({ ' -n, --config A filepath of your config script', ' Example of a config script: https://github.com/conventional-changelog/conventional-changelog-angular/blob/master/index.js', '', - ' -c, --context A filepath of a javascript that is used to define template variables' + ' -c, --context A filepath of a javascript that is used to define template variables', + '', + ' -d, --draft Publishes a draft instead of a real release', + ' Default: false' ] }, { alias: { @@ -41,7 +44,8 @@ var cli = meow({ r: 'releaseCount', v: 'verbose', n: 'config', - c: 'context' + c: 'context', + d: 'draft' } }); @@ -85,7 +89,8 @@ var changelogOpts = { pkg: { path: flags.pkg }, - releaseCount: flags.releaseCount + releaseCount: flags.releaseCount, + draft: flags.draft }; if (flags.verbose) { diff --git a/index.js b/index.js index 965e4fed..ecb2ae65 100644 --- a/index.js +++ b/index.js @@ -81,13 +81,16 @@ function conventionalGithubReleaser(auth, changelogOpts, context, gitRawCommitsO var prerelease = semver.parse(version).prerelease.length > 0; - var promise = Q.nfcall(github.releases.createRelease, { + var draft = changelogOpts.draft || false; + + var promise = Q.nfcall(github.repos.createRelease, { // jscs:disable owner: context.owner, repo: context.repository, tag_name: version, body: chunk.log, prerelease: prerelease, + draft: draft, target_commitish: changelogOpts.targetCommitish, name: changelogOpts.name || version // jscs:enable