-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·52 lines (52 loc) · 1.26 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
#!/bin/bash
# knit
source knit.sh
# make temporary copy of preprocessing folder with all data we need in build
cp -r analysis tmp
mv deploy.sh tmp/
# switch to gh-pages branch
git checkout gh-pages
if [ $? -eq 0 ]
then
echo "changed to gh-pages"
else
# revert
mv tmp/deploy.sh deploy.sh
rm -rf tmp/
exit 1
fi
# copy over index file (the processed main.Rmd) from master branch
cp tmp/main.html index.html
# clean
rm -rf rscript/
mkdir rscript
# copy over necessary scripts from master branch
cp tmp/main.Rmd rscript
# cp index.html rscript
# copy over other nessecary output files from master branch
cp -r tmp/output rscript/
# copy over other necessary input files from master branch
cp -r tmp/input rscript/
cp -r tmp/scripts rscript/
# remove ignore folder from folder that gets zipped
rm -rf rscript/output/ignore
rm -rf rscript/input/ignore
# zip the rscript folder
zip -r rscript.zip rscript
# remove the rscript folder
rm -rf rscript
# remove analysis folder
rm -rf analysis
# add everything for committing
git add .
git add -u
# commit in gh-pages
git commit -m "analysis: build and deploy to gh-pages"
# push to remote:gh-pages
git push origin gh-pages
# checkout master again
git checkout master
# copy back deploy.sh
mv tmp/deploy.sh .
# remove temporary folder
rm -rf tmp