Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gh-release

Package Overview
Dependencies
Maintainers
5
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh-release

Create a release for a node package on github.

  • 6.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.9K
decreased by-27.46%
Maintainers
5
Weekly downloads
 
Created
Source

gh-release

Create a release for a node package on GitHub.

npm build downloads

Features

  • Uses the Github Releases API to create a new GitHub release.
  • Defaults to using information from package.json and CHANGELOG.md.
  • Supports uploading release assets.

gh-release example

⚠️ Important ⚠️

This library abides by the well-established and widely adopted changelog conventions set forth in http://keepachangelog.com.

Any other conventions (autochangelog, standard-version, your favorite thing) are not supported, and support will not be added for them. This library is several years old and well into maintenance mode.

Install

$ npm install gh-release

Usage

Command-line interface

$ gh-release
Your GitHub username: ungoldman
Your GitHub password: ✔✔✔✔✔✔✔✔

creating release v1.0.0 for ungoldman/cool-project

name:               v1.0.0
tag_name:           v1.0.0
target_commitish:   9561804a4d1fca2525d3207bec4907dd5ec7a705
body:

* engage

? publish release to github? Yes
https://github.com/ungoldman/cool-project/releases/tag/v1.0.0

Should be run at the root of the project to be released.

Expects a package.json and CHANGELOG.md in the working directory.

Prints release URL to stdout on success.

Uses ghauth for authentication with Github. A Github API OAuth token is saved to the gh-release config directory after the first time authenticating. Note that the config directory is determined by application-config and is OS-specific. gh-release will alternatively use the token specified in the GH_RELEASE_GITHUB_API_TOKEN environment variable if it exists. This allows it to be used in continuous deployment systems, which can inject different GitHub API tokens depending on the location of the project.

Get usage info by running with --help or -h.

$ gh-release --help
Usage: gh-release [options]

Examples:
  gh-release -n v2.0.3 -c master -d    create a draft release with title v2.0.3 tagged at HEAD of master


Options:
  -t, --tag_name          tag for this release
  -c, --target_commitish  commitish value for tag
  -n, --name              text of release title
  -b, --body              text of release body
  -o, --owner             repo owner
  -r, --repo              repo name
  -d, --draft             publish as draft                          [default: false]
  -p, --prerelease        publish as prerelease                     [default: false]
  -w, --workpath          path to working directory                 [default: "/Users/ng/dev/git/gh-release"]
  -e, --endpoint          GitHub API endpoint URL                   [default: "https://api.github.com"]
  -a, --assets            comma-delimited list of assets to upload  [default: false]
  --dry-run               dry run (stops before release step)       [default: false]
  -y, --yes               bypass confirmation prompt for release    [default: false]
  -h, --help              Show help
  -v, --version           Show version number

Node API

var ghRelease = require('gh-release')

// all options have defaults and can be omitted
var options = {
  tag_name: 'v1.0.0',
  target_commitish: 'master',
  name: 'v1.0.0',
  body: '* init\n',
  draft: false,
  prerelease: false,
  repo: 'gh-release',
  owner: 'ungoldman',
  endpoint: 'https://api.github.com' // for GitHub enterprise, use http(s)://hostname/api/v3
}

// options can also be just an empty object
var options = {}

// auth is required
// it can be an API token...
options.auth = {
  token: 'XXXXXXXX'
}

// or it can either be a username & password
// (But only for GitHub Enterprise when endpoint is set)
options.auth = {
  username: 'ungoldman',
  password: 'XXXXXXXX'
}

ghRelease(options, function (err, result) {
  if (err) throw err
  console.log(result) // create release response: https://developer.github.com/v3/repos/releases/#response-4
})

Defaults

All default values taken from package.json unless specified otherwise.

namedescriptiondefault
tag_namerelease tag'v' + version
target_commitishcommitish value to tagHEAD of current branch
namerelease title'v' + version
bodyrelease textCHANGELOG.md section matching version
ownerrepo ownerrepo owner in repository
reporepo namerepo name in repository
draftpublish as draftfalse
prereleasepublish as prereleasefalse
assetsrelease assets to uploadfalse
endpointGitHub API endpoint URLhttps://api.github.com

Override defaults with flags (CLI) or the options object (node).

Standards

Example

All releases of gh-release were created with gh-release.

Config location

PlatformLocation
OS X~/Library/Application Support/gh-release/config.json
Linux (XDG)$XDG_CONFIG_HOME/gh-release/config.json
Linux (Legacy)~/.config/gh-release/config.json
Windows (> Vista)%LOCALAPPDATA%/gh-release/config.json
Windows (XP, 2000)%USERPROFILE%/Local Settings/Application Data/gh-release/config.json

Motivation

There are packages that already do something like this, and they're great, but I want something that does this one thing really well and nothing else, leans heavily on standards in package.json and CHANGELOG.md, and can work both as a CLI tool and programmatically in node.

Contributing

Contributions welcome! Please read the contributing guidelines first.

History

Please read the change log for a human-readable history of changes.

Tests

gh-release uses standard and tape for testing. You can run all tests with npm test.

See also

License

ISC

Keywords

FAQs

Package last updated on 16 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc