name: Build and Deploy Astro Site

on:
  push:
    branches: [ main ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Build and deploy
        run: |
          npm install
          npm run build
          
          # Deploy
          rm -rf /var/www/sites/dave-dmg/blog/*
          cp -r dist/* /var/www/sites/dave-dmg/blog/