name: Build & Deploy to EasyPanel on: push: branches: - source-code workflow_dispatch: jobs: build-and-notify: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: Install dependencies run: npm ci --no-audit --no-fund - name: Build Astro site run: npm run build - name: Trigger EasyPanel deploy if: success() env: EASYPANEL_WEBHOOK_URL: ${{ secrets.EASYPANEL_WEBHOOK_URL }} run: | if [ -z "$EASYPANEL_WEBHOOK_URL" ]; then echo "::warning::EASYPANEL_WEBHOOK_URL secret is empty — skipping deploy trigger. Set it in repo settings to enable auto-deploy." exit 0 fi echo "Triggering EasyPanel deploy at $EASYPANEL_WEBHOOK_URL" curl -fsS -X POST "$EASYPANEL_WEBHOOK_URL" \ -H "Content-Type: application/json" \ -d "{\"ref\":\"${{ github.ref }}\",\"sha\":\"${{ github.sha }}\",\"event\":\"push\"}" \ || echo "::error::EasyPanel webhook returned non-2xx (continuing — site already built in artifact if you want to download)" - name: Upload build artifact uses: actions/upload-artifact@v4 with: name: dist path: dist/ retention-days: 7