Skip to content

Commit 6f2ce2a

Browse files
authored
Update README.md
1 parent 1b1030f commit 6f2ce2a

1 file changed

Lines changed: 58 additions & 1 deletion

File tree

README.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ npm install -g github-release-cli
1616
Run `github-release` with `-h` or `--help` options:
1717

1818
```
19-
Usage: github-release [options]
19+
Usage: github-release [options] [file ...]
2020
2121
Options:
2222
@@ -30,6 +30,63 @@ Options:
3030
-b, --body <body> body
3131
```
3232

33+
## Secure Setup
34+
35+
### 1. Get an OAuth token from GitHub
36+
37+
First you will need to get an OAuth Token from GitHub using your own username and "note":
38+
39+
```
40+
curl \
41+
-u 'username' \
42+
-d '{"scopes":["repo"], "note":"Publish to GitHub Releases"}' \
43+
https://api.github.com/authorizations
44+
```
45+
46+
For users with two-factor authentication enabled, you must send the user's authentication code (i.e., one-time password) in the `X-GitHub-OTP` header:
47+
48+
```
49+
curl \
50+
-u 'username' \
51+
-H 'X-GitHub-OTP: 000000' \
52+
-d '{"scopes":["repo"], "note":"Publish to GitHub Releases"}' \
53+
https://api.github.com/authorizations
54+
```
55+
56+
### 2. Storing the OAuth token in an environment variable
57+
58+
For reducing security risks, you can store your OAuth token in an environment variable.
59+
60+
Export the token using the one you got from above:
61+
62+
```
63+
export GITHUB_TOKEN=your_token
64+
```
65+
66+
### 3. Set up a CI build
67+
68+
Now you're ready to upload assets to a GitHub repository from a CI server. For example:
69+
70+
```
71+
COMMIT_LOG=`git log -1 --format='%ci %H %s'`
72+
github-release \
73+
--owner=cheton \
74+
--repo=github-release-cli \
75+
--tag="${TRAVIS_BRANCH}" \
76+
--name="${TRAVIS_BRANCH}" \
77+
--body="${COMMIT_LOG}" \
78+
"releases/file.zip" \
79+
"releases/file.tar.gz"
80+
```
81+
82+
If you're using Travis CI, you may want to encrypt environment variables.
83+
84+
Learn how to define encrypted variables in .travis.yml:<br>
85+
https://docs.travis-ci.com/user/environment-variables/#Defining-encrypted-variables-in-.travis.yml
86+
87+
## Examples
88+
https://github.com/cncjs/cncjs/blob/master/.travis.yml
89+
3390
## License
3491

3592
MIT

0 commit comments

Comments
 (0)