sync-deploy #71
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 And Deploy To Github Pages | |
on: | |
# 允许手动push触发 | |
# push: | |
# branches: | |
# - master | |
# 允许外部仓库事件触发 | |
repository_dispatch: | |
types: | |
- sync-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: | |
CLEAN_CACHE: ${{ secrets.CLEAN_CACHE }} | |
if: ${{ env.CLEAN_CACHE == 'true' }} | |
run: | | |
npm run clean:yuque-token | |
npm run clean:yuque-pwd | |
npm run clean:notion | |
npm run clean:flowus | |
- name: 拉取语雀&Notion&FlowUs&飞书的文档 | |
env: | |
YUQUE_TOKEN: ${{ secrets.YUQUE_TOKEN }} | |
YUQUE_USERNAME: ${{ secrets.YUQUE_USERNAME }} | |
YUQUE_PWD: ${{ secrets.YUQUE_PWD }} | |
YUQUE_LOGIN: ${{ secrets.YUQUE_LOGIN }} | |
YUQUE_REPO: ${{ secrets.YUQUE_REPO }} | |
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} | |
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} | |
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }} | |
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }} | |
COS_IMAGE_BUCKET: ${{ secrets.COS_IMAGE_BUCKET }} | |
COS_IMAGE_REGION: ${{ secrets.COS_IMAGE_REGION }} | |
COS_HOST: ${{ secrets.COS_HOST }} | |
FLOWUS_TABLE_PAGE_ID: ${{ secrets.FLOWUS_TABLE_PAGE_ID }} | |
WORDPRESS_USERNAME: ${{ secrets.WORDPRESS_USERNAME }} | |
WORDPRESS_PASSWORD: ${{ secrets.WORDPRESS_PASSWORD }} | |
WORDPRESS_ENDPOINT: ${{ secrets.WORDPRESS_ENDPOINT }} | |
FEISHU_APP_ID: ${{ secrets.FEISHU_APP_ID }} | |
FEISHU_APP_SECRET: ${{ secrets.FEISHU_APP_SECRET }} | |
FEISHU_FOLDER_TOKEN: ${{ secrets.FEISHU_FOLDER_TOKEN }} | |
FEISHU_WIKI_ID: ${{ secrets.FEISHU_WIKI_ID }} | |
FLOWUS_TEMPLATE_TABLE_PAGE_ID: ${{ secrets.FLOWUS_TEMPLATE_TABLE_PAGE_ID }} | |
HALO_ENDPOINT: ${{ secrets.HALO_ENDPOINT }} | |
HALO_POLICY_NAME: ${{ secrets.HALO_POLICY_NAME }} | |
HALO_TOKEN: ${{ secrets.HALO_TOKEN }} | |
run: | | |
npm run sync:flowus | |
npm run sync:yuque-token | |
npm run sync:notion | |
npm run sync:wordpress | |
npm run sync:halo | |
npm run sync:feishu | |
npm run sync:feishu-wiki | |
- name: 配置Git用户名邮箱 | |
run: | | |
git config --global user.name "1874" | |
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 }} | |
- name: 生成静态文件 | |
env: | |
YUQUE_TOKEN: ${{ secrets.YUQUE_TOKEN }} | |
run: | | |
npm run docs:build | |
- name: 部署到Github Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
publish_dir: docs/.vitepress/dist | |
external_repository: LetTTGACO/LetTTGACO.github.io | |
publish_branch: master | |
commit_message: ${{ github.event.head_commit.message }} |