2
0

deploy.yml 1.9 KB

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