forked from cvdlab/plasm.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·85 lines (63 loc) · 2.38 KB
/
publish.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
78
79
80
81
82
83
84
85
#! /bin/bash
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
if [ "$branch" == "gh-pages" ]
then
echo "You cannot run publish.sh script in gh-pages branch."
echo "Checkout master branch"
else
if [ "$branch" == "master" ]
then
pages=$(git branch | egrep gh-pages | sed -n -e 's/^ \(.*\)/\1/p')
if [ "$pages" == "gh-pages" ]
then
git branch -D gh-pages
fi
version=$(grep -Eo '# version [[:digit:]]+' plasm.js.manifest | grep -Eo [[:digit:]]+)
version=$(($version + 1))
echo "plasm.js.manifest switched to version " $version
sed 's/# version [[:digit:]]*/# version '$version'/g' plasm.js.manifest > version.manifest.temp
rm plasm.js.manifest
mv version.manifest.temp plasm.js.manifest
git commit -a -m "update plasm.js.manifest version: ready for publish"
git checkout -b gh-pages
git submodule update
cp ./support/f.js/lib/f.js ./support/f.js.temp
cp ./support/simplexn.js/lib/simplexn.js ./support/simplexn.js.temp
rm -rf ./support/simplexn.js
rm -rf ./support/f.js
mv ./support/f.js.temp ./support/f.js
mv ./support/simplexn.js.temp ./support/simplexn.js
sed 's/ <script src="support\/simplexn.js\/lib\/simplexn.js"><\/script>/ <script src="support\/simplexn.js"><\/script>/g' index.html > simplexn.js.temp
rm index.html
mv simplexn.js.temp index.html
sed 's/ <script src="support\/f.js\/lib\/f.js"><\/script>/ <script src="support\/f.js"><\/script>/g' index.html > f.js.temp
rm index.html
mv f.js.temp index.html
sed 's/support\/simplexn.js\/lib\/simplexn.js/support\/simplexn.js/g' plasm.js.manifest > simplexn.js.manifest.temp
rm plasm.js.manifest
mv simplexn.js.manifest.temp plasm.js.manifest
sed 's/support\/f.js\/lib\/f.js/support\/f.js/g' plasm.js.manifest > f.js.manifest.temp
rm plasm.js.manifest
mv f.js.manifest.temp plasm.js.manifest
version=$(grep -Eo '# version [[:digit:]]+' plasm.js.manifest | grep -Eo [[:digit:]]+)
version=$(($version + 1))
echo $version
sed 's/# version [[:digit:]]*/# version '$version'/g' plasm.js.manifest > version.manifest.temp
rm plasm.js.manifest
mv version.manifest.temp plasm.js.manifest
rm History.md
# rm Readme.md
rm -rf docs
rm index.js
rm package.json
rm -rf test
rm .gitmodules
rm publish.sh
git add .
git commit -a -m "publishing gh-pages"
git push -f origin gh-pages
git checkout master
git submodule update
git branch -D gh-pages
fi
fi