name: Hugo

on:
  push:
    branches:
      - main

jobs:
  build:
    container:
      image: fung.uy/mycosystems/web-ci:latest
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: 'true'
      - name: Run build task
        run: hugo --minify
      - name: pre-compress
        run: find ./public/* -type f \( -name '*.html' -o -name '*.js' -o -name '*.css' \) -exec gzip -v -k -f --best {} \;
      - name: Deploy to Server
        uses: https://fung.uy/mirrors/ssh-deploy@main
        env:
          SSH_PRIVATE_KEY: ${{ secrets.PA_SSH_KEY }}
          ARGS: "-rlgoDzvc -i --delete"
          SOURCE: "public/"
          REMOTE_HOST: ${{ secrets.PA_HOST }}
          REMOTE_USER: ${{ secrets.PA_USER }}
          TARGET: ${{ secrets.PA_DATA_DIR }}/mycelia.blog