Created
February 28, 2018 02:37
-
-
Save njleonzhang/0b1410eb0b44c27cca8d0f9e79fc94be to your computer and use it in GitHub Desktop.
release script for node project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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