Skip to content

Instantly share code, notes, and snippets.

@njleonzhang
Created February 28, 2018 02:37
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 njleonzhang/0b1410eb0b44c27cca8d0f9e79fc94be to your computer and use it in GitHub Desktop.
Save njleonzhang/0b1410eb0b44c27cca8d0f9e79fc94be to your computer and use it in GitHub Desktop.
release script for node project
#!/usr/bin/env bash
set -e
if [[ -z $1 ]]; then
echo "Enter new version: "
read VERSION
else
VERSION=$1
fi
read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Releasing $VERSION ..."
# lint
npm run lint
# build
VERSION=$VERSION npm run build
# revise version in doc
echo "revising version in doc..."
sed -i '' "s/vue-data-tables@\(.*\)\/dist/vue-data-tables@$VERSION\/dist/g" docs/index.html
sed -i '' "s/<small>\(.*\)<\/small>/<small>$VERSION<\/small>/" docs/_coverpage.md
# commit
git add docs
git commit -m "build: build $VERSION"
npm version $VERSION --message "build: release $VERSION"
# push
git push origin refs/tags/v$VERSION
git push
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment