From cd4b748fdb3999a56506179652079f674f45ac2e Mon Sep 17 00:00:00 2001 From: Dmitry Shirokov Date: Mon, 16 Oct 2017 11:49:03 +1100 Subject: [PATCH] Release script --- package.json | 3 ++- scripts/release | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 scripts/release diff --git a/package.json b/package.json index 8cf6537..abef65e 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "url": "http://github.com/runk/node-chardet/issues" }, "scripts": { - "test": "mocha -R spec --recursive" + "test": "mocha -R spec --recursive", + "release": "scripts/release" }, "main": "index.js", "engine": { diff --git a/scripts/release b/scripts/release new file mode 100755 index 0000000..ceec696 --- /dev/null +++ b/scripts/release @@ -0,0 +1,17 @@ +#!/bin/bash + +# Exit immediately if a pipeline returns non-zero status +# http://www.gnu.org/software/bash/manual/bashref.html#The-Set-Builtin +set -e + +npm run lint +npm test + +if [ -n "$npm_config_major" ]; then SEMVER="major" +elif [ -n "$npm_config_patch" ]; then SEMVER="patch" +else SEMVER="minor"; fi + +npm version $SEMVER +github-publish-release +git push --follow-tags +npm publish