name: publish

on:
  push:
    branches:
      - main

jobs:
  publish:
    runs-on: docker
    container:
      image: ghcr.io/hugomods/hugo:exts-0.140.2
    env:
      SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
    steps:
      - uses: https://forge.melm.xyz/melmco/checkout@v4
        with:
          submodules: recursive
          fetch-depth: 0 # all history for all branches and tags\


      - name: Build
        run: |
          hugo --minify

      - name: rsync deployments
        uses: https://forge.melm.xyz/melmco/rsync-deployments@7.0.2
        with:
          switches: -avzr --delete
          path: ./public/
          remote_path: /var/www/melm.xyz/
          remote_host: 192.168.1.145
          remote_user: forgejo
          remote_key: ${{ secrets.SSH_PRIVATE_KEY }}
