This repository has been archived by the owner on Feb 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·67 lines (53 loc) · 1.52 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
# abort the script if there is a non-zero error
set -e
# show where we are on the machine
pwd
# make a directory to put the gh-pages branch
mkdir -p gh-pages-branch/
cd gh-pages-branch
# now lets setup a new repo so we can update the gh-pages branch
git init
git config --local user.email [email protected] > /dev/null 2>&1
git config --local user.name levelup > /dev/null 2>&1
git remote add --fetch origin https://github.com/twlevelup/syd-2018-s2-spaces.git
# switch into the the gh-pages branch
if git rev-parse --verify origin/gh-pages > /dev/null 2>&1
then
git checkout gh-pages
# delete any old site as we are going to replace it
# Note: this explodes if there aren't any, so moving it here for now
git rm -rf .
else
git checkout --orphan gh-pages
fi
# stage any changes and new files, include circleci config to avoid auto-build.
cp -a ../public/* .
mkdir -p .circleci
cat > .circleci/config.yml <<EOF
version: 2
jobs:
build:
docker:
- image: circleci/node:10.7.0
steps:
- run: "false"
workflows:
version: 2
build_test_deploy:
jobs:
- build:
filters:
branches:
ignore: /.*/
EOF
git add -A
# now commit
git commit --allow-empty -m "Deploy to GitHub pages"
# and push, but send any output to /dev/null to hide anything sensitive
git push --force --quiet origin gh-pages
# go back to where we started and remove the gh-pages git repo we made and used
# for deployment
cd ..
rm -rf gh-pages-branch
echo "Finished Deployment!"