docsify/build/release.sh

44 lines
783 B
Bash
Raw Normal View History

2017-05-30 04:27:49 +08:00
set -e
if [[ -z $1 ]]; then
echo "Enter new version: "
read VERSION
else
VERSION=$1
fi
read -p "Releasing $VERSION $RELEASE_TAG - are you sure? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Releasing $VERSION ..."
2017-05-30 04:39:43 +08:00
npm run test
2017-05-30 04:27:49 +08:00
# build
VERSION=$VERSION npm run build
# update packages
cd packages/docsify-server-renderer
npm version $VERSION
if [[ -z $RELEASE_TAG ]]; then
npm publish
else
npm publish --tag $RELEASE_TAG
fi
cd -
# commit
git add -A
2017-05-30 04:39:43 +08:00
git commit -m "[build] $VERSION $RELEASE_TAG"
npm version $VERSION --message "[release] $VERSION $RELEASE_TAG"
2017-05-30 04:27:49 +08:00
# publish
git push origin refs/tags/v$VERSION
git push
if [[ -z $RELEASE_TAG ]]; then
npm publish
else
npm publish --tag $RELEASE_TAG
fi
fi