Skip to content

Commit

Permalink
Merge pull request #26 from alanzhou-okta/master
Browse files Browse the repository at this point in the history
Update github API call & version and add draft release option
  • Loading branch information
hutson authored May 27, 2017
2 parents 0330f1b + c7bcd48 commit 434a304
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.


Expand Down
11 changes: 8 additions & 3 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -41,7 +44,8 @@ var cli = meow({
r: 'releaseCount',
v: 'verbose',
n: 'config',
c: 'context'
c: 'context',
d: 'draft'
}
});

Expand Down Expand Up @@ -85,7 +89,8 @@ var changelogOpts = {
pkg: {
path: flags.pkg
},
releaseCount: flags.releaseCount
releaseCount: flags.releaseCount,
draft: flags.draft
};

if (flags.verbose) {
Expand Down
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 434a304

Please sign in to comment.