deploy #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Docs | |
on: | |
# 允许手动push触发 | |
# push: | |
# branches: | |
# - master | |
# 允许外部仓库事件触发 | |
repository_dispatch: | |
types: | |
- deploy | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检查分支 | |
uses: actions/checkout@master | |
- name: 安装node环境 | |
uses: actions/setup-node@master | |
with: | |
node-version: "16.x" | |
- name: 安装依赖 | |
run: | | |
export TZ='Asia/Shanghai' | |
npm install --prod | |
- name: 拉取文档 | |
env: | |
YUQUE_USERNAME: ${{ secrets.YUQUE_USERNAME }} | |
YUQUE_PASSWORD: ${{ secrets.YUQUE_PASSWORD }} | |
YUQUE_LOGIN: ${{ secrets.YUQUE_LOGIN }} | |
YUQUE_REPO: ${{ secrets.YUQUE_REPO }} | |
HALO_ENDPOINT: ${{ secrets.HALO_ENDPOINT }} | |
HALO_TOKEN: ${{ secrets.HALO_TOKEN }} | |
HALO_POLICY_NAME: ${{ secrets.HALO_POLICY_NAME }} | |
OSS_SECRET_ID: ${{ secrets.OSS_SECRET_ID }} | |
OSS_SECRET_KEY: ${{ secrets.OSS_SECRET_KEY }} | |
OSS_BUCKET: ${{ secrets.OSS_BUCKET }} | |
OSS_REGION: ${{ secrets.OSS_REGION }} | |
run: | | |
npm run sync:local | |
npm run sync:halo | |
- name: 配置Git用户名邮箱 | |
run: | | |
git config --global user.name "flionay" | |
git config --global user.email "[email protected]" | |
- name: 提交拉取的文档到GitHub仓库 | |
run: | | |
echo `date +"%Y-%m-%d %H:%M:%S"` begin > time.txt | |
git add . | |
git commit -m "Refresh elog.cache.json" -a | |
- name: 推送文档到仓库 | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |