angular-docs-cn/aio/deploy-cn.sh
Zhicheng WANG d15b4822f8 fix: 修正 git commit 时出错的问题
怀疑是因为单个命令的响应时间过长或负载过重而被 kill 了,改成分批添加和提交文件后问题解决
2020-01-29 16:24:43 +08:00

46 lines
891 B
Bash
Executable File

#!/usr/bin/env bash
set -x
set -e
commitSha=$(git rev-parse --short HEAD)
commitMessage=$(git log --oneline -n 1)
cd `dirname $0`
yarn build
yarn preview > /tmp/preview.log &
pid=$!
sleep 3;
node ./tools/translator/bin/prerender.js
kill -9 ${pid}
if [[ ! -d "./ng-docs.github.io" ]]
then
git clone https://asnowwolf:${GITHUB_ACCESS_TOKEN}@github.com/ng-docs/preview.angular.cn.git ./ng-docs.github.io
fi
cp -r dist/* ./ng-docs.github.io
cd ./ng-docs.github.io
git add ./generated/docs/api/
git commit --allow-empty -am "${commitMessage}"
git add ./generated/docs/guide/
git commit --amend --allow-empty -am "${commitMessage}"
git add ./generated/docs/
git commit --amend --allow-empty -am "${commitMessage}"
git add ./generated/images/
git commit --amend --allow-empty -am "${commitMessage}"
git add .
git commit --amend --allow-empty -am "${commitMessage}"
git push
cd -