on:
  workflow_dispatch:
  push:
    paths:
      - 'site/**'
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: '0.83.1'

      - name: Build
        run: hugo --minify
        working-directory: site

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        if: github.ref == 'refs/heads/master'
        with:
          publish_dir: ./site/public
          github_token: ${{ secrets.GITHUB_TOKEN }}
          cname: kubeconform.mandragor.org
