Publishing from CI/CD

You can publish your documentation through your CI/CD pipeline. Doctave provides a convenient shell script that uploads your documentation, meaning it can be integrated with any CI/CD provider. See the publishing upload script section for more details.

Publish docs with a GitHub action

The following is an example of a GitHub action which automatically uploads your docs

  1. every time new code is pushed to the main branch
  2. every time there is a new pull request

It assumes you have added the DOCTAVE_UPLOAD_TOKEN as a secret to your GitHub repository.

# .github/workflows/docs.yaml
---
name: "CI Docs"
on:
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
      - docs/**
      - .github/workflows/docs.yaml
  pull_request:
    paths:
      - docs/**
      - .github/workflows/docs.yaml

jobs:
  build-and-publish:
    name: Build and publish docs
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Publish docs
        working-directory: docs
        shell: bash
        env:
          DOCTAVE_UPLOAD_TOKEN: ${{ secrets.DOCTAVE_UPLOAD_TOKEN }}
        run: |
          curl -L http://dashboard.doctave.com/doctave-upload.sh | bash -s -- .

This provides two useful features:

  • when new code is pushed to your main branch, your live docs will automatically be updated to the latest version.
  • when new pull requests are opened, a preview of those changes will automatically be built.

To automatically add the build preview link to your pull request, enable the GitHub preview link integration.

Was this page helpful?