2016-01-16 19:41:02 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
old_version="$(git describe --abbrev=0 --tags)"
|
|
|
|
new_version=$1
|
2016-01-17 22:33:13 +08:00
|
|
|
|
|
|
|
old_cdn="https://cdn.rawgit.com/konvajs/konva/${old_version}/konva.js"
|
|
|
|
new_cdn="https://cdn.rawgit.com/konvajs/konva/${new_version}/konva.js"
|
|
|
|
|
|
|
|
old_cdn_min="https://cdn.rawgit.com/konvajs/konva/${old_version}/konva.min.js"
|
|
|
|
new_cdn_min="https://cdn.rawgit.com/konvajs/konva/${new_version}/konva.min.js"
|
2016-01-16 19:41:02 +08:00
|
|
|
|
|
|
|
# make sure new version parameter is passed
|
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
echo "ERROR - pass new version. usage release.sh 0.11.0"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
# make sure changle log updated
|
|
|
|
while true; do
|
|
|
|
read -p "Did you update CHANGELOG.md? " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]* ) break;;
|
|
|
|
[Nn]* ) exit;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2017-10-08 18:18:57 +08:00
|
|
|
echo "Pulling"
|
|
|
|
git pull
|
|
|
|
|
2016-01-16 19:41:02 +08:00
|
|
|
echo "lint and test"
|
2018-06-15 14:17:00 +08:00
|
|
|
npm run lint
|
|
|
|
npm run build
|
2016-01-16 19:41:02 +08:00
|
|
|
|
|
|
|
echo "commit change log updates"
|
2016-03-31 11:02:06 +08:00
|
|
|
git commit -am "update CHANGELOG with new version" --allow-empty
|
2016-01-16 19:41:02 +08:00
|
|
|
|
|
|
|
echo "npm version $1 --no-git-tag-version"
|
2018-06-15 14:20:22 +08:00
|
|
|
npm version $1 --no-git-tag-version --allow-same-version
|
2016-01-16 19:41:02 +08:00
|
|
|
|
|
|
|
echo "build for $1"
|
2018-06-15 14:17:00 +08:00
|
|
|
npm run build
|
2016-03-31 11:02:06 +08:00
|
|
|
git commit -am "build for $1" --allow-empty
|
2016-01-16 19:41:02 +08:00
|
|
|
|
2016-01-17 22:33:13 +08:00
|
|
|
echo "update CDN link in REAME"
|
|
|
|
perl -i -pe "s|${old_cdn_min}|${new_cdn_min}|g" ./README.md
|
2016-03-31 11:02:06 +08:00
|
|
|
git commit -am "update cdn link" --allow-empty
|
2016-01-17 22:33:13 +08:00
|
|
|
|
2018-06-15 14:19:22 +08:00
|
|
|
echo "generate documentation"
|
|
|
|
npm start api
|
|
|
|
|
2016-01-16 19:41:02 +08:00
|
|
|
echo "create new git tag"
|
|
|
|
git tag $1
|
|
|
|
|
|
|
|
echo "archive documentation"
|
|
|
|
zip -r konva-v${new_version}-documentation.zip ./api/*
|
|
|
|
rm -r ./api
|
|
|
|
|
|
|
|
echo "documentation is generated"
|
|
|
|
echo "include konva-v${new_version}-documentation.zip into version in github"
|
|
|
|
|
2018-08-30 20:24:45 +08:00
|
|
|
cd ../konva
|
|
|
|
git push
|
|
|
|
git push --tags
|
|
|
|
npm publish
|
|
|
|
|
2016-01-16 19:41:02 +08:00
|
|
|
echo "copy konva.js into konva-site"
|
|
|
|
cp ./konva.js ../konva-site/
|
|
|
|
cd ../konva-site
|
|
|
|
|
|
|
|
echo "replace CDN links"
|
2016-01-17 22:33:13 +08:00
|
|
|
|
|
|
|
|
2016-01-16 19:41:02 +08:00
|
|
|
find source themes -exec perl -i -pe "s|${old_cdn}|${new_cdn}|g" {} +
|
|
|
|
|
2016-01-17 22:33:13 +08:00
|
|
|
find source themes -exec perl -i -pe "s|${old_cdn_min}|${new_cdn_min}|g" {} +
|
|
|
|
|
2016-01-16 19:41:02 +08:00
|
|
|
echo "regenerate site"
|
2017-02-08 00:27:45 +08:00
|
|
|
./deploy.sh
|
2016-01-16 19:41:02 +08:00
|
|
|
|
|
|
|
echo "DONE!"
|
|
|
|
|
|
|
|
echo "-------"
|
|
|
|
echo "Now you need:"
|
|
|
|
echo "create new relese in github and attach documentation https://github.com/konvajs/konva/releases"
|
|
|
|
echo "update CDN link to ${new_cdn} at http://codepen.io/lavrton/pen/myBPGo"
|