-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·58 lines (51 loc) · 1.37 KB
/
build.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
#!/bin/sh
#
# CPPaste4
# Copyright (c) 2015 - 2021 Sindastra <https://github.com/sindastra>
# All rights reserved.
#
# The above copyright notice and this notice shall be included in all
# copies or substantial portions of the Software.
#
# See LICENSE file for more info.
#
# @author Sindastra <https://github.com/sindastra>
# @copyright (c) 2015 - 2021 Sindastra <https://github.com/sindastra>
./setup_toolchain.sh
command -v git
if [ $? != "0" ]; then
echo 'FATAL: git not installed'
exit 1
fi
command -v java
if [ $? != "0" ]; then
echo 'FATAL: java not installed'
exit 1
fi
git diff --exit-code
SSTATUS=$?
if [ ${SSTATUS} -eq 1 ]; then
echo 'WORKING DIRECTORY CONTAINS **UNSTAGED** CHANGES!'
echo 'Bailing out...'
exit 1
fi
git diff --cached --exit-code
CSTATUS=$?
if [ ${CSTATUS} -eq 1 ]; then
echo 'WORKING DIRECTORY CONTAINS **UNCOMMITED** CHANGES!'
echo 'Bailing out...'
exit 1
fi
if [ -n "$(git status --porcelain)" ]; then
echo 'WORKING DIRECTORY **NOT** CLEAN!'
echo 'Bailing out...'
exit 1
fi
DATE=`date -u +%Y-%m-%d-%H%M%S`
BRANCH=`git rev-parse --abbrev-ref HEAD`
PRETTYHASH=`git log --pretty=format:'%h' -n 1`
SNAPSHOTNAME="CPPaste4-SNAPSHOT-${DATE}UTC-${BRANCH}-${PRETTYHASH}"
cp -rT src/www ${SNAPSHOTNAME}
java -jar toolchain/yuic*.jar src/www/style.css > ${SNAPSHOTNAME}/style.css
tar cvzf "snapshots/${SNAPSHOTNAME}.tgz" ${SNAPSHOTNAME}
rm -rf ${SNAPSHOTNAME}