b.org: Fix access to demo-files page
[blender-org.git] / deploy.sh
1 #!/bin/bash -e
2
3 case $1 in
4     blender.org*)
5         DEPLOYHOST="$1"
6         ;;
7     *)
8         echo "Use $0 blender.org" >&2
9         exit 1
10 esac
11
12 echo -n "Deploying to ${DEPLOYHOST}... "
13
14 if ! ping ${DEPLOYHOST} -q -c 1 -W 2 >/dev/null; then
15     echo "host ${DEPLOYHOST} cannot be pinged, refusing to deploy." >&2
16     exit 2
17 fi
18
19 echo "press [ENTER] to continue, Ctrl+C to abort."
20 read dummy
21
22
23 # macOS does not support readlink -f, so we use greadlink instead
24 if [[ `uname` == 'Darwin' ]]; then
25     command -v greadlink 2>/dev/null 2>&1 || { echo >&2 "Install greadlink using brew."; exit 1; }
26     readlink='greadlink'
27 else
28     readlink='readlink'
29 fi
30
31 ROOT="$(dirname "$($readlink -f "$0")")"
32 cd ${ROOT}
33
34 CONTENT="$ROOT/themes/"
35
36 if [ ! -d "$CONTENT" ]; then
37     echo "Unable to find dir $CONTENT"
38     exit 1
39 fi
40
41
42 echo
43 echo "*** GULPA GULPA ***"
44 if [ -x ./node_modules/.bin/gulp ]; then
45     ./node_modules/.bin/gulp
46 else
47     npm install && gulp
48 fi
49
50 echo
51 echo "*** SYNCING SITE ***"
52 rsync -avh --exclude '*.sass' --exclude '.DS_Store' --exclude '*.scss' --exclude '*.map' $CONTENT borg@${DEPLOYHOST}:/data/www/vhosts/code.blender.org/wordpress/wp-content/themes/
53
54
55 echo
56 echo "==================================================================="
57 echo "Deploy to ${DEPLOYHOST} is done."
58 echo "==================================================================="