From f729b0367d2c0967c9d3d560f545da43c54dc367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Roycourt?= Date: Thu, 23 Apr 2026 17:34:46 +0100 Subject: [PATCH] ci(fallback): add Filebase IPFS deployment workflow Adds a GitHub Actions workflow that builds the fallback app, uploads it to a Filebase IPFS bucket as a CAR, and publishes the resulting CID to the Site's IPNS so `morpho-fallback-app.myfilebase.site` auto-updates. The existing Fleek workflow is left in place and will be removed in a follow-up PR once Filebase is validated end-to-end. App changes required for IPFS hosting: - `base: "./"` in Vite config so asset paths resolve on path gateways - `VITE_IS_IPFS_BUILD` env flag hides the IPFS info button on IPFS-targeted builds (the button is meaningful only on Vercel) Co-Authored-By: Claude Opus 4.7 --- .github/workflows/filebase-deploy.yaml | 65 +++++++++++++++++++++++++ CLAUDE.md | 3 +- apps/fallback/src/components/footer.tsx | 2 + apps/fallback/src/vite-env.d.ts | 1 + apps/fallback/vite.config.ts | 1 + 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/filebase-deploy.yaml diff --git a/.github/workflows/filebase-deploy.yaml b/.github/workflows/filebase-deploy.yaml new file mode 100644 index 0000000..688792a --- /dev/null +++ b/.github/workflows/filebase-deploy.yaml @@ -0,0 +1,65 @@ +name: Deploy site via Filebase +on: + push: + branches: ["release"] + paths: + - "pnpm-lock.yaml" + - "packages/uikit/**" + - "apps/fallback/**" + - ".github/workflows/filebase-deploy.yaml" + +permissions: + contents: read + pull-requests: write + statuses: write + +jobs: + deploy-to-filebase: + environment: + name: IPFS + url: https://morpho-fallback-app.myfilebase.site + + runs-on: ubuntu-22.04 + strategy: + matrix: + node-version: [22] + steps: + - name: Checkout + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - name: Install pnpm + uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 + with: + version: 10 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Build fallback app + env: + VITE_IS_IPFS_BUILD: "true" + run: pnpm run fallback-app:build + - name: Upload CAR to Filebase + id: deploy + uses: ipshipyard/ipfs-deploy-action@266952049b3bf1bdc2afadcf568759e11ac1ef66 # v1.9.2 + with: + path-to-deploy: apps/fallback/dist + filebase-access-key: ${{ secrets.FILEBASE_ACCESS_KEY }} + filebase-secret-key: ${{ secrets.FILEBASE_SECRET_KEY }} + filebase-bucket: ${{ secrets.FILEBASE_BUCKET }} + github-token: ${{ github.token }} + - name: Publish new CID to Filebase Site (IPNS) + env: + FILEBASE_ACCESS_KEY: ${{ secrets.FILEBASE_ACCESS_KEY }} + FILEBASE_SECRET_KEY: ${{ secrets.FILEBASE_SECRET_KEY }} + SITE_LABEL: morpho-fallback-app.myfilebase.site + CID: ${{ steps.deploy.outputs.cid }} + run: | + TOKEN=$(printf '%s' "${FILEBASE_ACCESS_KEY}:${FILEBASE_SECRET_KEY}" | base64 -w 0) + curl -fsS -X PUT \ + -H "Authorization: Bearer ${TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"cid\":\"${CID}\"}" \ + "https://api.filebase.io/v1/names/${SITE_LABEL}" diff --git a/CLAUDE.md b/CLAUDE.md index f21ac48..c9172d9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -204,7 +204,8 @@ Same as Fallback, plus: ### Deployment - Lite app deploys to Vercel via `pnpm run deploy` in `apps/lite` -- Both apps support Fleek deployment (via `@fleek-platform/cli`) +- Fallback app deploys to IPFS via Filebase (see `.github/workflows/filebase-deploy.yaml`) — the action uploads a CAR to the bucket, then publishes the new CID to the Site's IPNS via the Filebase Platform API +- Both apps still support Fleek deployment (via `@fleek-platform/cli`); the Fleek workflow will be removed once the Filebase pipeline is validated - Ensure SPA routing is configured (all routes → `index.html`) ### Development Workflow diff --git a/apps/fallback/src/components/footer.tsx b/apps/fallback/src/components/footer.tsx index 74355c3..6f2e437 100644 --- a/apps/fallback/src/components/footer.tsx +++ b/apps/fallback/src/components/footer.tsx @@ -56,6 +56,8 @@ export function Footer() { return false; }, [ipfsDeployments]); + if (import.meta.env.VITE_IS_IPFS_BUILD === "true") return null; + return (