build-plugin-docs.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: Setup Node.js
  18. uses: actions/setup-node@v4
  19. with:
  20. node-version: '18'
  21. cache: 'yarn'
  22. cache-dependency-path: logseq/yarn.lock
  23. - name: Install dependencies
  24. working-directory: logseq/libs
  25. run: yarn install --frozen-lockfile
  26. - name: Build documentation
  27. working-directory: logseq/libs
  28. run: yarn build:docs
  29. - name: Checkout plugins repository
  30. uses: actions/checkout@v4
  31. with:
  32. repository: logseq/plugins
  33. token: ${{ secrets.PLUGIN_DOCS_SYNC_TOKEN }}
  34. path: plugins
  35. - name: Sync docs to plugins repository
  36. run: |
  37. cp -r logseq/libs/docs/* plugins/
  38. - name: Commit and push changes
  39. working-directory: plugins
  40. run: |
  41. git config user.name "github-actions[bot]"
  42. git config user.email "github-actions[bot]@users.noreply.github.com"
  43. git add .
  44. git diff --staged --quiet || git commit -m "chore: sync plugin docs from logseq/logseq@${{ github.sha }}"
  45. git push