name: Hugo Deploy Pipeline run-name: Builds the Hugo site and Deploys via SSH to the Server on: push: branches: - main jobs: Build-and-Deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true # Fetch Hugo themes (true OR recursive) fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: hugo-version: '0.128.0' - name: Install rsync run: apt install rsync - name: Build run: hugo --minify - name: Install SSH Key uses: shimataro/ssh-key-action@v2 with: key: ${{ secrets.SSH_PRIVATE_KEY }} known_hosts: 'placeholder' # to make it work - name: Adding Known Hosts run: ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts - name: Deploy with rsync run: rsync -avz --delete ./public/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_TARGET }}