name: CI/CD — Build & Deploy on: push: branches: [main] pull_request: branches: [main] jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: npm cache-dependency-path: | backend/package-lock.json frontend/package-lock.json - name: Install & build backend working-directory: backend run: | npm ci npm run build - name: Install & build frontend working-directory: frontend run: | npm ci npm run build deploy: name: Deploy to VPS runs-on: ubuntu-latest needs: build if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - name: Deploy via SSH uses: appleboy/ssh-action@v1 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /home/tetardtek/github/originsdigital git pull origin main docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build