name: docs

on:
  push:
    branches:
      - "main"
    paths:
      - "www/**/*"
      - ".github/workflows/docs.yml"
  pull_request:
    paths:
      - "www/**/*"
      - ".github/workflows/docs.yml"

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version-file: www/go.mod
      - uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3
        with:
          hugo-version: "latest"
          extended: true
      - run: hugo --minify --baseURL="/"
        working-directory: ./www/
      - uses: wjdp/htmltest-action@31be84a95c860a331e0cf9a99f71e3eb39d2f86b # master
        with:
          config: www/htmltest.yml
          path: www/public
