name: Julia Documentation

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

jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@latest
      - name: Install dependencies
        run: |
          cd julia/LibCEED.jl
          julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.build()'
      - name: Build and deploy
        env:
          DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
        run: |
          cd julia/LibCEED.jl
          julia --project=docs/ docs/make.jl
