build-plugin-docs.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Build and Sync Plugin Docs
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - master
  7. jobs:
  8. build-and-sync-docs:
  9. runs-on: ubuntu-latest
  10. # Only run on manual trigger or when the commit message starts with "chore(libs): bump version"
  11. if: github.event_name == 'workflow_dispatch' || startsWith(github.event.head_commit.message, 'chore(libs):bump version')
  12. steps:
  13. - name: Checkout logseq repository
  14. uses: actions/checkout@v4
  15. with:
  16. path: logseq
  17. - name: Set up pnpm
  18. uses: pnpm/action-setup@v4
  19. with:
  20. version: 10.33.0
  21. - name: Setup Node.js
  22. uses: actions/setup-node@v4
  23. with:
  24. node-version: '18'
  25. cache: 'pnpm'
  26. cache-dependency-path: logseq/libs/pnpm-lock.yaml
  27. - name: Install dependencies
  28. working-directory: logseq/libs
  29. run: pnpm install --frozen-lockfile
  30. - name: Build documentation
  31. working-directory: logseq/libs
  32. run: pnpm build:docs
  33. - name: Checkout plugins repository
  34. uses: actions/checkout@v4
  35. with:
  36. repository: logseq/plugins
  37. token: ${{ secrets.PLUGIN_DOCS_SYNC_TOKEN }}
  38. path: plugins
  39. - name: Sync docs to plugins repository
  40. run: |
  41. cp -r logseq/libs/docs/* plugins/
  42. - name: Commit and push changes
  43. working-directory: plugins
  44. run: |
  45. git config user.name "github-actions[bot]"
  46. git config user.email "github-actions[bot]@users.noreply.github.com"
  47. git add .
  48. git diff --staged --quiet || git commit -m "chore: sync plugin docs from logseq/logseq@${{ github.sha }}"
  49. git push