A command-line tool for managing release assets on a GitHub repository
npm install github-release-cli
A command-line tool for managing release assets on a GitHub repository.
```
npm install -g github-release-cli
Run github-release with -h or --help options:
`
Usage: github-release
Options:
-V, --version output the version number
--baseurl
--token
--owner
--repo
--tag
--commitish
--release-id
--release-name
--body Text describing the contents of the tag.
--draft [value] true makes the release a draft, and false publishes the release.true
--prerelease [value] to identify the release as a prerelease, false to identify the release as a full release.`
-h, --help display help for command
`sh`
github-release list
--owner cheton \
--repo github-release-cli
`sh`
github-release upload \
--owner cheton \
--repo github-release-cli \
--tag "v0.1.0" \
--release-name "v0.1.0" \
--body "This release contains bug fixes and imporvements, including:\n..." \
archive.zip index.html app.min.css app.min.js
#### Specify the commitish value for tag
`sh`
github-release upload \
--owner cheton \
--repo github-release-cli \
--commitish 6a8e375 \
--tag "v0.1.0" \
--release-name "v0.1.0" \
--body "The commitish value for tag"
#### Create a prerelease
`sh`
github-release upload \
--owner cheton \
--repo github-release-cli \
--tag "v0.1.0" \
--release-name "v0.1.0" \
--body "This is a prerelease" \
--prerelease
#### Change a prerelease to a published release
`sh`
github-release upload \
--owner cheton \
--repo github-release-cli \
--tag "v0.1.0" \
--release-name "v0.1.0" \
--body "This is a published release" \
--prerelease=false
#### Delete release assets
You can use glob expressions to match files:
`sh`
github-release delete \
--owner cheton \
--repo github-release-cli \
--tag "v0.1.0" \
archive.zip index.html "app.*"
#### Delete a release by specifying the tag name
`sh`
github-release delete \
--owner cheton \
--repo github-release-cli \
--tag "v0.1.0"
#### Delete a release by specifying the release id
`sh`
github-release delete \
--owner cheton \
--repo github-release-cli \
--release-id 17994985
https://github.com/cncjs/cncjs-pendant-tinyweb/blob/master/.travis.yml
First you will need to get an OAuth Token from GitHub using your own username and "note":
`sh`
curl \
-u 'username' \
-d '{"scopes":["repo"], "note":"Publish to GitHub Releases"}' \
https://api.github.com/authorizations
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:
`sh`
curl \
-u 'username' \
-H 'X-GitHub-OTP: 000000' \
-d '{"scopes":["repo"], "note":"Publish to GitHub Releases"}' \
https://api.github.com/authorizations
For reducing security risks, you can store your OAuth token in an environment variable.
Export the token using the one you got from above:
`sh`
export GITHUB_TOKEN=your_token
Now you're ready to upload assets to a GitHub repository from a CI server. For example:
`shgit log -1 --format='%ci %H %s'
COMMIT_LOG=`
github-release upload \
--owner=cheton \
--repo=github-release-cli \
--tag="latest" \
--release-name="${TRAVIS_BRANCH}" \
--body="${COMMIT_LOG}" \
"releases/myapp-0.1.0-win-x32.exe" \
"releases/myapp-0.1.0-win-x64.exe"
If you're using Travis CI, you may want to encrypt environment variables:
`sh``
travis encrypt GITHUB_TOKEN=your_token
Learn how to define encrypted variables in .travis.yml:
https://docs.travis-ci.com/user/environment-variables/#Defining-encrypted-variables-in-.travis.yml
MIT