name: Deploy

on:
  push:
    branches: [main]
  workflow_dispatch:

env:
  HUGO_VERSION: "0.151.0"

jobs:
  deploy:
    runs-on: ubuntu-latest
    container:
      image: node:20-bookworm
      volumes:
        - /srv/www:/srv/www
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
          fetch-depth: 0

      - name: Install Hugo extended
        run: |
          curl -sL "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-arm64.tar.gz" | tar xz
          install hugo /usr/local/bin/

      - name: Build and deploy to /srv/www/blog
        run: hugo --gc --minify --cleanDestinationDir --destination /srv/www/blog
