代码拉取完成,页面将自动刷新
#!/bin/sh
set -e # Exit with nonzero exit code if anything fails
# Copied from here: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"
LEANPUB_BRANCH="leanpub"
BUILD_COMMIT_MSG="Update book (travis build ${TRAVIS_BUILD_NUMBER})"
BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
# Create datasets
Rscript scripts/prepare_data.R
cd manuscript
# Create references
make -B 11-references.Rmd
# Compile html version of book for gh-pages
make -B html
# Compile md version of book for leanpub
# make -B leanpub
cd ..
## Only deploy when on master branch of main repository
if [ "$BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ] ; then
echo "Deploying master to gh-pages."
# Clone the existing gh-pages for this repo into out/
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deply)
git clone -b $TARGET_BRANCH https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git out
cd out
git rm -rf ./*
cp -r ../manuscript/_book/* ./
touch .nojekyll
git add .nojekyll
git add --all ./*
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
git config credential.helper "store --file=.git/credentials"
echo "https://${GH_TOKEN}:@github.com" > .git/credentials
git commit -m "${BUILD_COMMIT_MSG}" --allow-empty
# Now that we're all set up, we can push.
git push origin $TARGET_BRANCH
# echo "Deploying master to leanpub branch."
# cd ../
# rm -r out
# git add -f manuscript/*.md
# git add -f images/*
# git commit -m "${BUILD_COMMIT_MSG}"
# git push origin $LEANPUB_BRANCH
else
echo "Changes are not being deployed, since this is a fork / branch."
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。