Continuous Integration

The gitbook CLI can be used in a CI environment to publish the integrations for every commit.

With GitHub Actions

First store an API token created from app.gitbook.com/account/developer into your GitHub repository secrets.

Then in you workflow:

jobs:
  publish:
    name: Publish to GitBook
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18.x
      - run: npm ci
      - run: npm install -g @gitbook/cli
      - run: gitbook publish .
        env:
            GITBOOK_TOKEN: ${{ secrets.GITBOOK_TOKEN }}

Last updated