forked from konvajs/konva
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·77 lines (55 loc) · 1.91 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
set -e
old_version="$(git describe --abbrev=0 --tags)"
new_version=$1
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"
new_cdn_min="https://unpkg.com/konva@${new_version}/konva.min.js"
# 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
echo "Old version: ${old_version}"
echo "New version: ${new_version}"
echo "Pulling"
git pull >/dev/null
echo "build and test"
npm run build >/dev/null
# npm run test
echo "commit change log updates"
git commit -am "update CHANGELOG with new version" --allow-empty >/dev/null
echo "npm version $1 --no-git-tag-version"
npm version $1 --no-git-tag-version --allow-same-version >/dev/null
echo "build for $1"
npm run build >/dev/null
git commit -am "build for $1" --allow-empty >/dev/null
echo "update CDN link in REAME"
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
cd ../konva
git push >/dev/null
git push --tags >/dev/null
npm publish
echo "copy konva.js into konva-site"
cp ./konva.js ../konva-site/
cd ../konva-site
echo "replace CDN links"
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
echo "regenerate site"
./deploy.sh >/dev/null
echo "DONE!"