• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    JavaScript
  • License
    ISC License
  • Created almost 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸš€ Create a GitHub Release for a Node package.
rocket

gh-release

Create a GitHub Release for a Node package.

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.

Install

$ npm install gh-release

Usage

Command-line interface

$ gh-release
Your GitHub username: ungoldman
Your GitHub password: βœ”βœ”βœ”βœ”βœ”βœ”βœ”βœ”

creating release v1.0.9 for ungoldman/gh-release-test

name:               v1.0.9
tag_name:           v1.0.9
target_commitish:   3b06705e43be83363f063966f36ede3990a2842a
endpoint:           https://api.github.com
body:

### Maintenance
* test: testing latest CLI output
* deps: gh-release@6
* pkg: set package to private
* pkg: update repo URLS
* misc: ignore package-lock.json

? publish release to github? Yes
https://github.com/ungoldman/gh-release-test/releases/tag/v1.0.9

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: current directory]
  -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.

name description default
tag_name release tag 'v' + version
target_commitish commitish value to tag HEAD of current branch
name release title 'v' + version
body release text CHANGELOG.md section matching version
owner repo owner repo owner in repository
repo repo name repo name in repository
draft publish as draft false
prerelease publish as prerelease false
assets release assets to upload false
endpoint GitHub API endpoint URL https://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

Platform Location
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.

⚠️ Important Note ⚠️

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

Any other conventions (autochangelog, standard-version, etc.) are not currently supported, and support will likely not be added for them in the future. This library is several years old and well into maintenance mode.

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

Rocket image is from emojipedia.

More Repositories

1

hyperaxe

πŸͺ“ An enchanted hyperscript weapon.
JavaScript
117
star
2

himawari-bg

🌏 Set the latest image from Himawari 8 as your desktop background.
JavaScript
90
star
3

style.css

πŸ”° Classless stylesheet for HTML documents.
SCSS
77
star
4

changelog-parser

πŸͺ΅ Change log parser for node.
JavaScript
75
star
5

module-init

🏁 Create a new node module with all the right stuff.
JavaScript
71
star
6

sitedown

πŸ“„ Turn some markdown files into a website.
JavaScript
69
star
7

magnet-link

DEPRECATED: Get a magnet link from a torrent file.
JavaScript
63
star
8

format-duration

⏱ Convert milliseconds to a standard duration string.
JavaScript
57
star
9

nano-s3

Upload a file to S3.
JavaScript
45
star
10

gamepad-tester

Simple electron app for testing the Gamepad API.
JavaScript
27
star
11

electron-hello-world

πŸ™… [deprecated]
JavaScript
25
star
12

electron-browser-window-options

Reference for default Electron BrowserWindow options.
JavaScript
23
star
13

gfm.css

Styles for github flavored markdown.
HTML
22
star
14

martin

πŸ™… [deprecated]
Ruby
21
star
15

electron-multiple-windows-demo

An example electron app showing how to manage multiple windows.
JavaScript
20
star
16

coolgifs.neocities.org

πŸ†’ the web site of cool gifs 😎
JavaScript
19
star
17

himawari-urls

🌐 Get URLs for Himawari 8 image tiles based on a given date.
JavaScript
19
star
18

init-module

🍬 Add some sugar to the npm init command.
JavaScript
19
star
19

dotfiles

πŸ’» Minimalist config for working in a terminal environment.
Shell
18
star
20

hi8

🌻 See Earth from Himawari-8 on your desktop every 10 minutes.
JavaScript
15
star
21

module.party

❌ dead site
HTML
14
star
22

jekyll-reveal

markdown β†’ slides (reveal.js) β†’ gh-pages (jekyll)
CSS
13
star
23

pino-gris

A verbose ndjson log formatter for pino.
JavaScript
13
star
24

reader

Quick sketch of a feed reader built with Electron.
JavaScript
12
star
25

contact

πŸ’¬ How to contact me on the internet.
11
star
26

open-source-maintenance-guidelines

🐢 How to be a Good Open Source Shepherd
11
star
27

gh-release-assets

Upload assets to a GitHub release
JavaScript
10
star
28

no-moments

Hide the "Moments" button on Twitter.
CSS
10
star
29

yt-pip

πŸ“Ί Watch youtube videos using macOS picture-in-picture.
JavaScript
9
star
30

yokel

8
star
31

contracts

πŸ“ Generate a web development contract based on a template.
JavaScript
8
star
32

goes-bg

🌎 Set the latest image from GOES 16 & 17 as your desktop background.
JavaScript
8
star
33

bagel.technology

❌ dead site
HTML
7
star
34

earth-tweets

❌ dead site
JavaScript
7
star
35

himawari-history

Download all Himawari 8 images in a date range.
JavaScript
7
star
36

CONTRIBUTING.md

Open contributing and collaborating guidelines.
6
star
37

tinystore

tiny web storage wrapper
JavaScript
6
star
38

meowl.party

❌ dead site
HTML
6
star
39

cwp

Get a path string relative to the current working directory.
JavaScript
5
star
40

kill-desktop-osx

Kill Your Desktop (OS X only).
JavaScript
5
star
41

hype-html

nanohtml (and hyperx) packaged for esm
JavaScript
5
star
42

top-bar.css

🎩 A top bar navigation pattern.
HTML
5
star
43

fritter-crawler

Rough draft of a script for crawling the fritter network.
JavaScript
5
star
44

electron-repl

Interactive REPL for debugging Electron programs.
JavaScript
5
star
45

electron-ipc-log

[deprecated] Log all user-defined IPC traffic in an electron app.
JavaScript
4
star
46

droptop

JavaScript
4
star
47

contribs

πŸ™ Generate boilerplate open source contributing guidelines.
JavaScript
4
star
48

dragon-wario

Command-line CYOA with Node.js.
JavaScript
4
star
49

npm-maintainer-dash

πŸ”¬ list user's npm pkgs sorted by monthly downloads
JavaScript
3
star
50

latest-earth

HTML
3
star
51

shape-rotator

JavaScript
3
star
52

isc-license

Generate an ISC license.
JavaScript
3
star
53

trimet-bus-sim

PDX Bus Driver Sim 2000
JavaScript
3
star
54

kill-tweet-stream

Save time by hiding the tweet stream on Twitter.
CSS
3
star
55

neocities-cli

JavaScript
3
star
56

is-webgl-enabled

Detect if WebGL is enabled in the current environment.
JavaScript
3
star
57

proton

⚑ electron + photon app boilerplate (wip)
HTML
2
star
58

boing

Est quid sit.
HTML
2
star
59

gravatar-url-cli

Get a Gravatar URL for an email from the command line.
JavaScript
2
star
60

module-downloads

Dashboard for viewing module downloads from the NPM registry.
JavaScript
2
star
61

burger-week-challenge-2014

A burger challenge map.
HTML
2
star
62

atp-readline

post to an atproto service from the command line
TypeScript
1
star
63

broken-remote

JavaScript
1
star
64

tools

A list of development tools I've built or used.
1
star
65

signalhub.decent.digital

Signalhub server for Hypermodules projects
1
star
66

cgsa

Cellular Geographic Service Areas (FCC)
1
star
67

intro-to-node

JavaScript
1
star
68

qr2p

JavaScript
1
star
69

node-static-server-template

Quick! Serve a static site with node.js!
JavaScript
1
star
70

css-units

JavaScript
1
star
71

parcel-express

Starter kit for working with parcel and express.
JavaScript
1
star
72

tetromino

real-time multi-player tetris with node and socket.io
JavaScript
1
star
73

eternal-recurrence

✍️ Generative creative writing via OpenAI
JavaScript
1
star
74

donothing.online

❌ dead site
HTML
1
star
75

docker-env-vars

all the ways env vars work in docker
Dockerfile
1
star
76

box-socket

A simple demonstration of real-time multiplayer interaction with WebSockets.
JavaScript
1
star