Skip to content

Instantly share code, notes, and snippets.

@sommestad
Created October 12, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sommestad/1e1cfed3aebc11b7b079 to your computer and use it in GitHub Desktop.
Save sommestad/1e1cfed3aebc11b7b079 to your computer and use it in GitHub Desktop.
NPM: Release new version
#!/bin/sh
#############################################
# Run from the directory of the NPM module #
#############################################
VERSION_TYPE=$1
if [ -z "$VERSION_TYPE" ]; then
echo "Usage: ./npm-release.sh <major|minor|patch>";
exit 1;
fi
echo "Create ${VERSION_TYPE} NPM release"
echo "Get the latest from master..."
git checkout master
git pull
echo "Create NPM version (and tag)..."
npm version ${VERSION_TYPE}
echo "Push commit and tag..."
git push --tags && git push
echo "Publish to NPM..."
npm publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment