Skip to content

Commit eff3932

Browse files
authored
Merge pull request #12 from cheton/feature/commitish
Support for specifying the commitish value for tag
2 parents 2a19922 + 80b7563 commit eff3932

4 files changed

Lines changed: 34 additions & 18 deletions

File tree

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ os:
88
- linux
99

1010
node_js:
11-
- '8'
1211
- '6'
12+
- '8'
13+
- '10'
1314

1415
before_install:
1516
- npm install -g npm

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ Options:
2121
-V, --version output the version number
2222
--baseurl <baseurl> API endpoint (default: "https://api.github.com")
2323
-T, --token <token> OAuth2 token
24-
-o, --owner <owner> owner
25-
-r, --repo <repo> repo
26-
-t, --tag <tag> tag
27-
-n, --name <name> name
28-
-b, --body <body> body
29-
-d, --draft [value] draft
30-
-p, --prerelease [value] prerelease
24+
-o, --owner <owner> The repository owner.
25+
-r, --repo <repo> The repository name.
26+
-t, --tag <tag> The name of the tag.
27+
-c, --commitish <value> Specifies the commitish value for tag. Unused if the tag already exists.
28+
-n, --name <name> The name of the release.
29+
-b, --body <body> Text describing the contents of the tag.
30+
-d, --draft [value] `true` makes the release a draft, and `false` publishes the release.
31+
-p, --prerelease [value] `true` to identify the release as a prerelease, `false` to identify the release as a full release.
3132
-h, --help output usage information
3233
```
3334

@@ -43,6 +44,18 @@ github-release upload \
4344
archive.zip index.html app.min.css app.min.js
4445
```
4546

47+
#### Specify the commitish value for tag
48+
49+
```sh
50+
github-release upload \
51+
--owner cheton \
52+
--repo github-release-cli \
53+
--commitish 6a8e375 \
54+
--tag "v0.1.0" \
55+
--name "v0.1.0" \
56+
--body "The commitish value for tag"
57+
```
58+
4659
#### Create a prerelease
4760

4861
```sh

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-release-cli",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "A command-line tool for managing release assets on a GitHub repository",
55
"homepage": "https://github.com/cheton/github-release-cli",
66
"author": "Cheton Wu <cheton@gmail.com>",

src/index.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ program
1515
.usage('<command> [<args>]')
1616
.option('--baseurl <baseurl>', 'API endpoint', 'https://api.github.com')
1717
.option('-T, --token <token>', 'OAuth2 token')
18-
.option('-o, --owner <owner>', 'owner')
19-
.option('-r, --repo <repo>', 'repo')
20-
.option('-t, --tag <tag>', 'tag')
21-
.option('-n, --name <name>', 'name')
22-
.option('-b, --body <body>', 'body')
23-
.option('-d, --draft [value]', 'draft', function(val) {
18+
.option('-o, --owner <owner>', 'The repository owner.')
19+
.option('-r, --repo <repo>', 'The repository name.')
20+
.option('-t, --tag <tag>', 'The name of the tag.')
21+
.option('-c, --commitish <value>', 'Specifies the commitish value for tag. Unused if the tag already exists.')
22+
.option('-n, --name <name>', 'The name of the release.')
23+
.option('-b, --body <body>', 'Text describing the contents of the tag.')
24+
.option('-d, --draft [value]', '`true` makes the release a draft, and `false` publishes the release.', function(val) {
2425
if (String(val).toLowerCase() === 'false') {
2526
return false;
2627
}
2728
return true;
2829
})
29-
.option('-p, --prerelease [value]', 'prerelease', function(val) {
30+
.option('-p, --prerelease [value]', '`true` to identify the release as a prerelease, `false` to identify the release as a full release.', function(val) {
3031
if (String(val).toLowerCase() === 'false') {
3132
return false;
3233
}
@@ -64,7 +65,7 @@ function next(response) {
6465

6566
const fn = {
6667
'upload': async () => {
67-
const { owner, repo, tag, name, body, draft, prerelease } = program;
68+
const { owner, repo, tag, commitish, name, body, draft, prerelease } = program;
6869
const files = args;
6970
let release;
7071

@@ -82,11 +83,12 @@ const fn = {
8283

8384
try {
8485
if (!release) {
85-
console.log(`> createRelease: tag_name=${tag}, name=${name || tag}, draft=${!!draft}, prerelease=${!!prerelease}`);
86+
console.log(`> createRelease: tag_name=${tag}, target_commitish=${commitish}, name=${name || tag}, draft=${!!draft}, prerelease=${!!prerelease}`);
8687
const res = await octokit.repos.createRelease({
8788
owner,
8889
repo,
8990
tag_name: tag,
91+
target_commitish: commitish,
9092
name: name || tag,
9193
body: body || '',
9294
draft: !!draft,

0 commit comments

Comments
 (0)