-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·50 lines (39 loc) · 1.25 KB
/
deploy.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
#!/usr/bin/env bash
echo Beginning deployment
BUCKET=potree-movie
GITHUBPAGESFOLDER=~/hobu/helheim.lidar.io/
FILES=( movie/dist/bundle.js movie/dist/main.css movie/index.html index.html favicon* glacier.png )
LIBS=( movie/libs movie/build )
(cd movie && npx webpack) || exit 1
for FILE in ${FILES[@]}; do
aws s3 cp ./$FILE s3://$BUCKET/$FILE || exit 1
cp ./$FILE $GITHUBPAGESFOLDER/$FILE
(cd $GITHUBPAGESFOLDER && git add $FILE)
done
for LIB in ${LIBS[@]}; do
cp -r ./$LIB $GITHUBPAGESFOLDER/movie
list=$(aws s3 ls s3://$BUCKET/$LIB/)
if [ -z "$list" ]
then
aws s3 cp --recursive ./$LIB s3://$BUCKET/$LIB/ || exit 1
else
echo Library $LIB already exists, skipping...
fi
done
#STAGED=$(git diff)
#UNSTAGED=$(git diff --cached)
#echo $STAGED
#echo $UNSTAGED
#if [ -n "$STAGED" ]; then
# if [ -n "$UNSTAGED" ]; then
# echo Clean diff - commiting to build repo
# fi
#fi
if [[ `git status --porcelain --untracked-files=no` ]]; then
echo "Uncommited changes, not sending to build repo"
else
echo "All changes committed, creating commit in build repo... (you must still push)"
HEADSHA=$(git rev-parse HEAD)
(cd $GITHUBPAGESFOLDER && git commit -m "Git build $HEADSHA")
fi
echo Deployment complete