name: Pfiouuuuuuuu
on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Hell
        uses: actions/setup-node@v3
        with:
          node-version: 19

      - name: YOCaml
        uses: ocaml/setup-ocaml@v2
        with:
          ocaml-compiler: 5.1.1
          opam-depext-flags: --with-test

      - run: (cd hell; npm install; npm run build)
      - run: opam install . --deps-only --with-doc --with-test
      - run: opam install yourbones_js yourbones_js-beacon
      - run: opam exec -- dune build --profile=release
      - run: opam exec -- dune exec bin/capsule_cli/capsule.exe -- build

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
          publish_dir: ./www
          external_repository: xvw/xvw.github.io
          publish_branch: master
          enable_jekyll: false
