vue2/scripts/release.sh

81 lines
1.8 KiB
Bash
Raw Normal View History

2018-03-22 22:02:40 +08:00
#!/bin/bash
2016-06-11 07:02:16 +08:00
set -e
if [[ -z $1 ]]; then
echo "Enter new version: "
2018-03-22 22:02:40 +08:00
read -r VERSION
else
VERSION=$1
fi
read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
2016-06-11 07:02:16 +08:00
echo "Releasing $VERSION ..."
2017-07-13 14:39:41 +08:00
if [[ -z $SKIP_TESTS ]]; then
npm run lint
npm run flow
npm run test:cover
npm run test:e2e -- --env phantomjs
2017-07-13 14:39:41 +08:00
npm run test:ssr
fi
2016-12-02 08:45:17 +08:00
# Sauce Labs tests has a decent chance of failing
# so we usually manually run them before running the release script.
# if [[ -z $SKIP_SAUCE ]]; then
# export SAUCE_BUILD_ID=$VERSION:`date +"%s"`
# npm run test:sauce
# fi
2016-06-11 07:02:16 +08:00
# build
VERSION=$VERSION npm run build
# update packages
2018-03-22 22:02:40 +08:00
# using subshells to avoid having to cd back
( ( cd packages/vue-template-compiler
npm version "$VERSION"
if [[ -z $RELEASE_TAG ]]; then
npm publish
2017-02-25 07:26:08 +08:00
else
2018-03-22 22:02:40 +08:00
npm publish --tag "$RELEASE_TAG"
fi
2018-03-22 22:02:40 +08:00
)
2016-06-11 07:02:16 +08:00
cd packages/vue-server-renderer
2018-03-22 22:02:40 +08:00
npm version "$VERSION"
if [[ -z $RELEASE_TAG ]]; then
npm publish
2017-02-25 07:26:08 +08:00
else
2018-03-22 22:02:40 +08:00
npm publish --tag "$RELEASE_TAG"
fi
2018-03-22 22:02:40 +08:00
)
2016-06-11 07:02:16 +08:00
# commit
git add -A
git add -f \
dist/*.js \
packages/vue-server-renderer/basic.js \
2019-01-17 00:22:02 +08:00
packages/vue-server-renderer/build.dev.js \
packages/vue-server-renderer/build.prod.js \
packages/vue-server-renderer/server-plugin.js \
packages/vue-server-renderer/client-plugin.js \
2019-01-17 00:22:02 +08:00
packages/vue-template-compiler/build.js \
packages/vue-template-compiler/browser.js
2017-07-13 13:57:16 +08:00
git commit -m "build: build $VERSION"
# generate release note
npm run release:note
# tag version
2018-03-22 22:02:40 +08:00
npm version "$VERSION" --message "build: release $VERSION"
2016-06-11 07:02:16 +08:00
# publish
2018-03-22 22:02:40 +08:00
git push origin refs/tags/v"$VERSION"
2016-06-11 07:02:16 +08:00
git push
if [[ -z $RELEASE_TAG ]]; then
npm publish
2017-02-25 07:26:08 +08:00
else
2018-03-22 22:02:40 +08:00
npm publish --tag "$RELEASE_TAG"
fi
2016-06-11 07:02:16 +08:00
fi