npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

github-release-cli

v2.1.0

Published

A command-line tool for managing release assets on a GitHub repository

Downloads

3,687

Readme

github-release-cli build status

NPM

A command-line tool for managing release assets on a GitHub repository.

Installation

npm install -g github-release-cli

Command Line Usage

Run github-release with -h or --help options:

Usage: github-release <command> [<args>]

Options:
  -V, --version          output the version number
  --baseurl <baseurl>    API endpoint (default: "https://api.github.com")
  --token <token>        OAuth2 token (default: null)
  --owner <owner>        The repository owner. (default: "")
  --repo <repo>          The repository name. (default: "")
  --tag <tag>            The name of the tag.
  --commitish <value>    Specifies the commitish value for tag. Unused if the tag already exists.
  --release-id <id>      The release id.
  --release-name <name>  The name of the release. (default: "")
  --body <body>          Text describing the contents of the tag.
  --draft [value]        `true` makes the release a draft, and `false` publishes the release.
  --prerelease [value]   `true` to identify the release as a prerelease, `false` to identify the release as a full release.
  -h, --help             display help for command

Commands

List

github-release list
  --owner cheton \
  --repo github-release-cli

Upload

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

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

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

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

Delete release assets

You can use glob expressions to match files:

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

github-release delete \
  --owner cheton \
  --repo github-release-cli \
  --tag "v0.1.0"

Delete a release by specifying the release id

github-release delete \
  --owner cheton \
  --repo github-release-cli \
  --release-id 17994985

Examples

https://github.com/cncjs/cncjs-pendant-tinyweb/blob/master/.travis.yml

Secure Setup

1. Get an OAuth token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note":

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:

curl \
  -u 'username' \
  -H 'X-GitHub-OTP: 000000' \
  -d '{"scopes":["repo"], "note":"Publish to GitHub Releases"}' \
  https://api.github.com/authorizations

2. Storing the OAuth token in an environment variable

For reducing security risks, you can store your OAuth token in an environment variable.

Export the token using the one you got from above:

export GITHUB_TOKEN=your_token

3. Set up a CI build

Now you're ready to upload assets to a GitHub repository from a CI server. For example:

COMMIT_LOG=`git log -1 --format='%ci %H %s'`
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:

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

License

MIT