sync-deploy #93
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-22.04 | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --prod | |
- 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: | | |
pnpm run sync:flowus | |
pnpm run sync:yuque-token | |
pnpm run sync:notion | |
pnpm run sync:halo | |
pnpm run sync:feishu | |
pnpm run sync:feishu-wiki | |
- name: 配置Git用户名邮箱 | |
run: | | |
git config --global user.name "1874" | |
git config --global user.email "1225751694@qq.com" | |
- 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: | | |
pnpm 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 }} |