deploy.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. name: Deploy With Actions
  2. on:
  3. workflow_dispatch
  4. concurrency:
  5. group: "main-deploy-branch-workflow"
  6. cancel-in-progress: false
  7. jobs:
  8. build:
  9. runs-on: ubuntu-latest
  10. permissions:
  11. contents: write
  12. pages: write
  13. id-token: write
  14. steps:
  15. - uses: actions/checkout@v3
  16. with:
  17. fetch-depth: 2
  18. persist-credentials: true
  19. - name: Config Git User
  20. run: |
  21. git config --local user.name "dragooncjw"
  22. git config --local user.email "289056872@qq.com"
  23. - uses: actions/setup-node@v3
  24. with:
  25. node-version: 18
  26. registry-url: 'https://registry.npmjs.org/'
  27. - name: Rush Install
  28. run: node common/scripts/install-run-rush.js install -t @flowgram.ai/docs
  29. - name: Rush build
  30. run: node common/scripts/install-run-rush.js build -t @flowgram.ai/docs
  31. - name: Generate docs
  32. run: |
  33. cd apps/docs
  34. npm run docs
  35. - name: Copy auto-docs to en
  36. run: cp -r apps/docs/src/zh/auto-docs apps/docs/src/en/auto-docs
  37. - name: Build Doc site
  38. run: |
  39. cd apps/docs
  40. npm run build
  41. - name: Replace docs
  42. run: |
  43. rm -rf docs
  44. mv apps/docs/doc_build docs
  45. # 🔥 新增步骤:在 docs 目录下生成 vercel.json
  46. - name: Create vercel.json
  47. run: |
  48. cat > docs/vercel.json <<EOF
  49. {
  50. "version": 2,
  51. "buildCommand": "",
  52. "outputDirectory": ".",
  53. "cleanUrls": true,
  54. "trailingSlash": false
  55. }
  56. EOF
  57. # 🔥 推送到 gh-pages 分支
  58. - name: Push to gh-pages branch
  59. uses: peaceiris/actions-gh-pages@v3
  60. with:
  61. github_token: ${{ secrets.GITHUB_TOKEN }}
  62. publish_dir: ./docs
  63. publish_branch: gh-pages
  64. force: true