name: Build and publish

on:
    push:
        branches:
            - master

jobs:
  publishing:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.8'

      - name: Setup Poetry
        uses: abatilo/actions-poetry@v2
        with:
          poetry-version: '1.5.1'

      - name: Install Poetry dependencies
        run: poetry install --no-root

      - name: Build
        run: poetry run mkdocs build

      - name: Publish
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./site
          publish_branch: site
