name: Local Build and Deploy on: push: branches: - main jobs: deploy: # Target your specific local runner using its precise labels runs-on: [ubuntu-latest, ubuntu-22.04, shell] steps: - name: Run Deploy Scripts Locally run: | set -e echo "--- EPIC WEB CONTROL: Starting Auto-Cleanup & Deploy ---" # 1. Clean up "dead" containers docker container prune -f || true # 2. Navigate to your website directory cd /var/www/atom-nexst/ # 3. Fetch and update code using the local web user to maintain SSH permissions sudo -u www-data git fetch origin --prune sudo -u www-data git reset --hard origin/main # 4. Install dependencies, run migrations, and build the application /usr/local/bin/pnpm install --frozen-lockfile /usr/local/bin/pnpm db:migrate /usr/local/bin/pnpm prisma generate /usr/local/bin/pnpm build # 5. Restart the application service sudo systemctl restart atom-nexst.service echo "--- Deployment successfully completed ---"