konva/release.sh

78 lines
1.9 KiB
Bash
Raw Normal View History

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
2018-10-11 02:34:18 +08:00
old_cdn="https://unpkg.com/konva@${old_version}/konva.js"
new_cdn="https://unpkg.com/konva@${new_version}/konva.js"
old_cdn_min="https://unpkg.com/konva@${old_version}/konva.min.js"
2019-02-28 00:18:21 +08:00
new_cdn_min="https://unpkg.com/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
2019-02-28 00:18:21 +08:00
echo "Old version: ${old_version}"
echo "New version: ${new_version}"
2017-10-08 18:18:57 +08:00
echo "Pulling"
2019-02-27 22:34:29 +08:00
git pull >/dev/null
2017-10-08 18:18:57 +08:00
2021-05-22 00:01:24 +08:00
echo "build and test"
npm run build >/dev/null
2022-08-06 00:13:09 +08:00
# npm run test
2019-09-18 01:57:01 +08:00
2016-01-16 19:41:02 +08:00
echo "commit change log updates"
2019-02-27 22:34:29 +08:00
git commit -am "update CHANGELOG with new version" --allow-empty >/dev/null
2016-01-16 19:41:02 +08:00
echo "npm version $1 --no-git-tag-version"
2019-02-27 22:34:29 +08:00
npm version $1 --no-git-tag-version --allow-same-version >/dev/null
2016-01-16 19:41:02 +08:00
echo "build for $1"
2019-02-27 22:34:29 +08:00
npm run build >/dev/null
git commit -am "build for $1" --allow-empty >/dev/null
2016-01-16 19:41:02 +08:00
2025-03-21 04:40:15 +08:00
echo "update CDN link in README"
2019-02-27 22:34:29 +08:00
perl -i -pe "s|${old_cdn_min}|${new_cdn_min}|g" ./README.md >/dev/null
git commit -am "update cdn link" --allow-empty >/dev/null
echo "create new git tag"
git tag $1 >/dev/null
2016-01-17 22:33:13 +08:00
2018-08-30 20:24:45 +08:00
cd ../konva
2019-02-27 22:34:29 +08:00
git push >/dev/null
git push --tags >/dev/null
2023-09-19 00:13:10 +08:00
npm publish
2018-08-30 20:24:45 +08:00
2025-03-21 04:40:15 +08:00
# echo "copy konva.js into konva-site"
# cp ./konva.js ../konva-site/
# cd ../konva-site
2016-01-16 19:41:02 +08:00
2025-03-21 04:40:15 +08:00
# echo "replace CDN links"
2016-01-17 22:33:13 +08:00
2025-03-21 04:40:15 +08:00
# find source themes/hexo3/layout react-demos vue-demos main-demo -name "*.json" -exec perl -i -pe "s|${old_version}|${new_version}|g" {} + >/dev/null
# find source themes/hexo3/layout react-demos vue-demos main-demo -name "*.html" -exec perl -i -pe "s|${old_version}|${new_version}|g" {} + >/dev/null
2016-01-17 22:33:13 +08:00
2025-03-21 04:40:15 +08:00
# echo "regenerate site"
# ./deploy.sh >/dev/null
2016-01-16 19:41:02 +08:00
echo "DONE!"