mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-05-24 23:03:45 +00:00
48 lines
915 B
Bash
48 lines
915 B
Bash
# Based on Vue.js Release file
|
|
# https://github.com/vuejs/vue/blob/dev/build/release.sh
|
|
|
|
set -e
|
|
|
|
function get_package_version {
|
|
echo $(cat package.json \
|
|
| grep version \
|
|
| head -1 \
|
|
| awk -F: '{ print $2 }' \
|
|
| sed 's/[",]//g')
|
|
}
|
|
|
|
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 ..."
|
|
|
|
# check errors
|
|
npm run lint
|
|
|
|
# generate docs tree
|
|
PACKAGE_VERSION=$(get_package_version)
|
|
cp -Rf dist/docs tmp-docs
|
|
|
|
# build
|
|
VERSION=$VERSION npm run build
|
|
cp -Rf tmp-docs dist/docs/v$PACKAGE_VERSION
|
|
rm -Rf tmp-docs
|
|
|
|
# commit
|
|
git add -A
|
|
git commit -m "[build] $VERSION"
|
|
npm version $VERSION --message "[release] $VERSION"
|
|
|
|
# publish
|
|
git push origin refs/tags/v$VERSION
|
|
git push
|
|
npm run deploy-docs
|
|
npm publish
|
|
fi
|