-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·48 lines (42 loc) · 956 Bytes
/
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
#!/bin/sh
git checkout master
echo "Checking out to temporary directory ..."
echo
git branch -D deployment/temp 2>/dev/null
git checkout -b deployment/temp
echo
echo "Generating data and building assets ..."
echo
pushd src/data/
./generate.sh
popd
npm run production
echo
echo "Current directory is: "
pwd
echo "To deploy changes, we need to run 'rm -rf' on the current directory ..."
echo
echo "The following files will be deleted... "
ls -Al1 | grep -E -v "dist|CNAME|.git|node_modules"
echo
read -p "Continue(Y/y)? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
ls -Al1 | grep -E -v "dist|CNAME|.git|node_modules" | xargs rm -rf
echo "node_modules/" > .gitignore
fi
echo "Setting up deployment branch ..."
echo
cp -r ./dist/* .
rm -rf dist/
git add --all
git commit -m "New deployment"
git push origin deployment/temp:gh-pages -f
git checkout master
echo
echo "Cleaning up ..."
echo
git clean -f
git branch -D deployment/temp 2>/dev/null
echo