name: Documentation

on:
  push:
    branches:
      - main
    tags: '*'
  pull_request:

jobs:
  build:
    name: Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: '1'
      - uses: julia-actions/julia-buildpkg@v1
      - uses: julia-actions/julia-docdeploy@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
      - run: |
          julia --project=docs -e '
            using Documenter: DocMeta, doctest
            using WassersteinDictionaries
            DocMeta.setdocmeta!(WassersteinDictionaries, :DocTestSetup, :(using WassersteinDictionaries); recursive=true)
            doctest(WassersteinDictionaries)'
