name: Deploy
on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout tree
        uses: actions/checkout@v4

      - name: Set-up OCaml
        uses: ocaml/setup-ocaml@v3
        with:
          ocaml-compiler: "5.1.1"
      - run: opam install . --deps-only --with-test
      - run: opam exec -- dune build --profile=release
      - run: opam exec -- dune exec bin/ring.exe -- build --target ./_site

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v4
        with:
          deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
          publish_dir: ./_site
          publish_branch: gh-pages
          enable_jekyll: false
