name: Deploy
on:
  push:
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          submodules: true

      - name: Install Go
        run: |
          wget -q https://go.dev/dl/go1.24.2.linux-amd64.tar.gz
          tar -C /usr/local -xzf go1.24.2.linux-amd64.tar.gz
          echo "/usr/local/go/bin" >> $GITHUB_PATH

      - name: Install Hugo
        run: |
          wget -q -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.146.0/hugo_extended_0.146.0_linux-amd64.deb
          dpkg -i hugo.deb

      - name: Build
        run: |
          hugo mod vendor
          hugo --minify

      - name: Deploy
        run: |
          mkdir -p /var/www/codejava.tech
          rsync -a --delete public/ /var/www/codejava.tech/
