-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathupdate
executable file
·54 lines (39 loc) · 1.04 KB
/
update
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
#!/usr/bin/env bash
GITREPO="highlight.js"
GITURL="git://github.com/isagalaev/highlight.js.git"
build-script() {
local BUILDFILE=`ls tools/build.*`
if [[ $BUILDFILE == "tools/build.py" ]]; then
local RUN=`which python3`
else
# Some systems use nodejs as the executable for Node.js. This is to
# call either node or nodejs executable depending on what is
# available.
local RUN=`which nodejs || which node`
npm install
fi
$RUN $BUILDFILE $*
}
# Update this repository first, just to be on the safe side
git fetch origin
git merge origin/master
if [[ ! -d $GITREPO ]]; then
git clone $GITURL $GITREPO --depth 10
fi
cd $GITREPO
# Grab the latest tagged version
TAGNAME=`git tag --list | sort --reverse | head -n 1`
BUILDDIR="../build"
git pull
git checkout $TAGNAME
rm -rf $BUILDDIR
# Build for CDN
build-script -t cdn :common
cp -R build $BUILDDIR
git checkout master
cd ..
git add --all
git commit -m "Update to version ${TAGNAME}"
git tag --annotate $TAGNAME -m "Version ${TAGNAME}"
git push origin
git push --tags