1 Star 0 Fork 64

pinefire/linux-tutorial

forked from turnon/linux-tutorial 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
deploy.sh 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
turnon 提交于 2020-02-10 23:11 +08:00 . update docs
#!/usr/bin/env sh
# ------------------------------------------------------------------------------
# gh-pages 部署脚本
# @author Zhang Peng
# @since 2020/2/10
# ------------------------------------------------------------------------------
# 装载其它库
ROOT_DIR=$(cd `dirname $0`/..; pwd)
# 确保脚本抛出遇到的错误
set -e
cd ${ROOT_DIR}/docs
# 生成静态文件
npm install
npm run build
# 进入生成的文件夹
cd dist
# 如果是发布到自定义域名
# echo 'www.example.com' > CNAME
git init
git checkout -b gh-pages && git add .
git commit -m 'deploy'
# 如果发布到 https://<USERNAME>.github.io/<REPO>
if [[ ${GITHUB_TOKEN} && ${GITEE_TOKEN} ]]; then
echo "使用 token 公钥部署 gh-pages"
# ${GITHUB_TOKEN} 是 Github 私人令牌;${GITEE_TOKEN} 是 Gitee 私人令牌
# ${GITHUB_TOKEN} 和 ${GITEE_TOKEN} 都是环境变量;travis-ci 构建时会传入变量
git push --force --quiet "https://dunwu:${GITHUB_TOKEN}@github.com/dunwu/linux-tutorial.git" gh-pages
git push --force --quiet "https://turnon:${GITEE_TOKEN}@gitee.com/turnon/linux-tutorial.git" gh-pages
else
echo "使用 ssh 公钥部署 gh-pages"
git push -f git@github.com:dunwu/linux-tutorial.git gh-pages
git push -f git@gitee.com:turnon/linux-tutorial.git gh-pages
fi
cd ${ROOT_DIR}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/pinefire/linux-tutorial.git
git@gitee.com:pinefire/linux-tutorial.git
pinefire
linux-tutorial
linux-tutorial
master

搜索帮助