Files
logseq/.github/workflows/build-plugin-docs.yml

60 lines
1.7 KiB
YAML

name: Build and Sync Plugin Docs
on:
workflow_dispatch:
push:
branches:
- master
jobs:
build-and-sync-docs:
runs-on: ubuntu-latest
# Only run on manual trigger or when the commit message starts with "chore(libs): bump version"
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.head_commit.message, 'chore(libs):bump version')
steps:
- name: Checkout logseq repository
uses: actions/checkout@v4
with:
path: logseq
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 10.33.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'
cache-dependency-path: logseq/libs/pnpm-lock.yaml
- name: Install dependencies
working-directory: logseq/libs
run: pnpm install --frozen-lockfile
- name: Build documentation
working-directory: logseq/libs
run: pnpm build:docs
- name: Checkout plugins repository
uses: actions/checkout@v4
with:
repository: logseq/plugins
token: ${{ secrets.PLUGIN_DOCS_SYNC_TOKEN }}
path: plugins
- name: Sync docs to plugins repository
run: |
cp -r logseq/libs/docs/* plugins/
- name: Commit and push changes
working-directory: plugins
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff --staged --quiet || git commit -m "chore: sync plugin docs from logseq/logseq@${{ github.sha }}"
git push