commit
8c1d787797
|
|
@ -26,11 +26,25 @@ jobs:
|
|||
uses: actions/setup-node@v1 # 作用:安装nodejs
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }} # 版本
|
||||
- name: run deploy.sh # 步骤3
|
||||
env: # 设置环境变量
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
CODING_TOKEN: ${{ secrets.CODING_TOKEN }}
|
||||
run: npm install && npm run deploy
|
||||
- name: build-commit-push # 步骤3
|
||||
run: |
|
||||
remote_addr=`git remote get-url --push origin`
|
||||
commit_info=`git describe --all --always --long`
|
||||
user_name=`git log -1 --pretty=format:'%an'`
|
||||
user_email=`git log -1 --pretty=format:'%ae'`
|
||||
npm install
|
||||
npm run build
|
||||
cd docs/.vuepress/dist
|
||||
git config --global init.defaultBranch hp-pages
|
||||
git init
|
||||
git config user.name ${user_name}
|
||||
git config user.email ${user_email}
|
||||
git add -A
|
||||
git commit -m "auto deploy, $commit_info"
|
||||
remote_addr=`echo $remote_addr | awk -F'://' '{print $2}'`
|
||||
remote_addr=https://${user_name}:${{secrets.GITHUB_TOKEN}}@${remote_addr}
|
||||
git remote add origin ${remote_addr}
|
||||
git push origin HEAD:gh-pages --force # 推送到github gh-pages分支
|
||||
|
||||
# 如只提交到github pages可以使用github-pages-deploy-action,详见: https://github.com/JamesIves/github-pages-deploy-action
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue