Wait im stupid fix #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and publish images | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - ".github/workflows/**" | |
| - "editor-backend/**" | |
| - "Dockerfile" | |
| - "package.json" | |
| - "bun.lock" | |
| - "src/**" | |
| - "public/**" | |
| - "next.config.ts" | |
| - ".gitattributes" | |
| - "scripts/docker-entrypoint.sh" | |
| - "drizzle/**" | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| EDITOR_BACKEND_IMAGE: ghcr.io/${{ github.repository_owner }}/breadboard-editor-backend | |
| NEXTJS_IMAGE: ghcr.io/${{ github.repository_owner }}/breadboard | |
| jobs: | |
| # ── Quick gates before heavy builds ────────────────────────────── | |
| gate: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.3.6" | |
| - run: bun install --frozen-lockfile | |
| - run: bun run lint | |
| - run: bunx tsc --noEmit | |
| # ── Editor backend (heavy: ESP-IDF + QEMU + arduino-cli) ──────── | |
| editor-backend: | |
| runs-on: ubuntu-latest | |
| needs: gate | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push editor backend | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./editor-backend | |
| file: ./editor-backend/Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.EDITOR_BACKEND_IMAGE }}:latest | |
| ${{ env.EDITOR_BACKEND_IMAGE }}:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # ── Next.js app ───────────────────────────────────────────────── | |
| nextjs: | |
| runs-on: ubuntu-latest | |
| needs: gate | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Next.js | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.NEXTJS_IMAGE }}:latest | |
| ${{ env.NEXTJS_IMAGE }}:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # ── Deploy (triggers Orchard webhooks for both services) ──────── | |
| deploy: | |
| runs-on: ubuntu-22.04 | |
| needs: [editor-backend, nextjs] | |
| environment: production | |
| env: | |
| ORCHARD_WEBHOOK_NEXTJS: ${{ secrets.ORCHARD_WEBHOOK_NEXTJS }} | |
| ORCHARD_WEBHOOK_BACKEND: ${{ secrets.ORCHARD_WEBHOOK_BACKEND }} | |
| steps: | |
| - name: Trigger Next.js Orchard deploy | |
| if: env.ORCHARD_WEBHOOK_NEXTJS != '' | |
| run: | | |
| curl -sS -X POST "$ORCHARD_WEBHOOK_NEXTJS" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"tag":"${{ github.sha }}"}' | |
| echo "Next.js webhook dispatched" | |
| - name: Trigger editor-backend Orchard deploy | |
| if: env.ORCHARD_WEBHOOK_BACKEND != '' | |
| run: | | |
| curl -sS -X POST "$ORCHARD_WEBHOOK_BACKEND" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"tag":"${{ github.sha }}"}' | |
| echo "Editor backend webhook dispatched" |