diff --git a/.gitea/workflows/hugo.yml b/.gitea/workflows/hugo.yml index 25be684..e437e78 100644 --- a/.gitea/workflows/hugo.yml +++ b/.gitea/workflows/hugo.yml @@ -1,14 +1,28 @@ -with: - host: 172.20.1.231 - username: root - password: ${{ secrets.SERVER_PASSWORD }} - script: | - cd /var/www/blog - git pull origin main --recurse-submodules - - # Build the site. This updates the /public folder. - hugo --minify --baseURL="https://dustin.coffee" - - # Caddy is already running as a service. - # It sees the new files in /public immediately. - # No restart or pkill required! \ No newline at end of file +name: Hugo CI/CD + +on: + push: + branches: [ main ] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Deploy via SSH + uses: appleboy/ssh-action@v1.0.3 + with: + host: 172.20.1.231 + username: root + password: ${{ secrets.SERVER_PASSWORD }} + script: | + cd /var/www/blog + git pull origin main --recurse-submodules + + # Build the static site (The 'Hugo Way') + hugo --minify + + pkill -f "hugo server" || true + sleep 2 + nohup hugo server --bind 0.0.0.0 --port 1313 --baseURL=https://dustin.coffee --appendPort=false --disableLiveReload > /var/log/hugo.log 2>&1 & + sleep 3 + curl -f https://dustin.coffee || echo "Health check failed - check /var/log/hugo.log" \ No newline at end of file