forked from microbiome/microbiome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.deploy.sh
executable file
·71 lines (54 loc) · 1.85 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
68
#!/bin/bash
# See https://medium.com/@nthgergo/publishing-gh-pages-with-travis-ci-53a8270e87db
set -e # Exit with nonzero exit code if anything fails
SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"
# Save some useful information
#SHA=`git rev-parse --verify HEAD`
GH_REPO="@github.com/microbiome/microbiome.git"
FULL_REPO="https://$GH_TOKEN$GH_REPO"
#function doCompile {
# run pkgdown, put results in 'docs' directory,i
# and don't paste the results of the examples
# then copy the whole thing to `out`
# Rscript -e "pkgdown::build_site(path = 'docs', examples = TRUE)"
# cp -R ../docs .
# ls ../ > files3.txt
# ./compile.sh
#}
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
echo "Skipping deploy; just doing a build."
exit 0
fi
rm -rf public # ; || exit 0;
mkdir -p public
# config
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
# Unzip the newly created R package
tar -zxvf *.tar.gz
# Deploy
cd public
git init
# Copy the vignettes from the newly generated package in here
cp ../microbiome/inst/doc/*.html .
cp -R ../microbiome/docs .
# Run our compile script
# doCompile
# ls ../ > files3.txt
# Rscript -e "pkgdown::build_site(path = 'docs', examples = TRUE)"
# Rscript -e "library(pkgdown)"
# R CMD BATCH "library(devtools)" # pkgdown::build_site(path = 'docs', examples = TRUE)
ls ../ > testfiles1.txt
ls ../microbiome/inst/extras/homepage > testfiles2.txt
# Add to git and deploy
git add *.html
git add *.txt
# git add docs
git commit -a -m "Deploy to Github Pages"
git push --force --quiet $FULL_REPO $SOURCE_BRANCH:$TARGET_BRANCH # > /dev/null 2>&1
# --------------------------------
#for files in '../microbiome/vignettes/*.html'; do
# cp $files .
#done