A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
ci(turbo): share build results through Vercel Remote Cache
Amruth Pillai5ef2be2ca27d
diff --git a/.agents/docs/turbo-remote-cache.md b/.agents/docs/turbo-remote-cache.mdnew file mode 100644index 000000000..ed195a1ce--- /dev/null+++ b/.agents/docs/turbo-remote-cache.md@@ -0,0 +1,32 @@+# Turbo remote cache++Main-branch CI and Docker builds share Turbo task results through Vercel Remote Cache. Vercel deployments+of the same team use it automatically. Pull requests keep only the Actions cache, which restores main's latest+results, so nothing they build reaches a published image or a Vercel deployment.++## Setup++1. In the Vercel team that owns the deployment: Settings → Build and Deployment → OIDC Policies for CLI Access →+ add a Turborepo CLI policy for GitHub repository `reactive-resume/reactive-resume`, restricted to branch `main`.+2. Add the repository variable `TURBO_TEAM` with the team slug (`gh variable set TURBO_TEAM --body <slug>`).++No secret is stored: `vercel/setup-turborepo-remote-cache-action` exchanges each job's GitHub OIDC token for a+short-lived Turbo token and revokes it when the job ends. Without `TURBO_TEAM`, or on a ref the policy doesn't+match, the step is skipped or fails softly and builds run as before.++## Where it applies++- `ci.yml` test job, push events only (main): unit `test:ci`, typecheck and the browser suite's build.+- `docker-publish.yml` build job: the token reaches the image build as the `TURBO_TOKEN` BuildKit secret, never a+ build arg, because published provenance records build args. `TURBO_TEAM` is an ordinary build arg.++## Keeping hashes equal++A Docker build only reuses checkout results when Turbo computes the same task hashes in both places. The+Dockerfile restores what `turbo prune` changes or drops: the original root `package.json`, `.gitignore` (without+it, Turbo hashes `node_modules/.bin` links), and the `globalDependencies` files. Check after changing `turbo.json`+globals or the Dockerfile's builder stage: compare `pnpm exec turbo run build --filter=web --filter=server+--dry=json` task hashes from a checkout with the same command run in the builder stage.++The build task hashes the root `package.json` because web and server embed its version; without it, a release+commit that only bumps the version would restore the previous build.diff --git a/.dockerignore b/.dockerignoreindex 7d3abdf25..2d0c40007 100644--- a/.dockerignore+++ b/.dockerignore@@ -1,6 +1,5 @@# VCS and editor state.git-.gitignore.cursor.DS_Store.vite-hooksdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 4230ee4b5..b912f2fb5 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -51,6 +51,9 @@ jobs:OAUTH_TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/oauth_testruns-on: ${{ vars.USE_BLACKSMITH == 'true' && 'blacksmith-32vcpu-ubuntu-2404' || 'ubuntu-latest' }}timeout-minutes: 30+ permissions:+ contents: read+ id-token: writeservices:postgres:@@ -91,6 +94,15 @@ jobs:node-version-file: ".nvmrc"cache: "pnpm"+ # Short-lived Vercel Remote Cache token from GitHub OIDC; without TURBO_TEAM or a matching policy, the local cache serves.+ # Only main pushes get one, so pull requests can't write artifacts that Docker builds reuse.+ - name: Set up Turbo remote cache+ if: ${{ vars.TURBO_TEAM != '' && github.event_name == 'push' }}+ continue-on-error: true+ uses: vercel/setup-turborepo-remote-cache-action@49d7b1b46ba4c9251e1977986bfe18336feabc8f # v1.1.0+ with:+ team: ${{ vars.TURBO_TEAM }}+- name: Restore and save Turbo cacheuses: actions/cache@v6with:diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.ymlindex 0941904d2..15314e0f5 100644--- a/.github/workflows/docker-publish.yml+++ b/.github/workflows/docker-publish.yml@@ -142,6 +142,14 @@ jobs:tags: |type=raw,value=sha-${{ steps.source.outputs.sha }}-${{ matrix.arch }}+ # Short-lived Vercel Remote Cache token from GitHub OIDC; without TURBO_TEAM or a matching policy, the local cache serves.+ - name: Set up Turbo remote cache+ if: ${{ vars.TURBO_TEAM != '' }}+ continue-on-error: true+ uses: vercel/setup-turborepo-remote-cache-action@49d7b1b46ba4c9251e1977986bfe18336feabc8f # v1.1.0+ with:+ team: ${{ vars.TURBO_TEAM }}+- name: Build and push imageid: buildif: ${{ vars.USE_BLACKSMITH != 'true' }}@@ -155,7 +163,12 @@ jobs:tags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}annotations: ${{ steps.meta.outputs.annotations }}- build-args: APP_REVISION=${{ steps.source.outputs.sha }}+ build-args: |+ APP_REVISION=${{ steps.source.outputs.sha }}+ TURBO_TEAM=${{ env.TURBO_TEAM }}+ # A secret, not a build arg: provenance records build args.+ secrets: |+ TURBO_TOKEN=${{ env.TURBO_TOKEN }}- name: Build and push image (Blacksmith)id: build-blacksmithdiff --git a/Dockerfile b/Dockerfileindex cecc18ab4..5014498a1 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,4 +1,4 @@-# syntax=docker/dockerfile:1.7+# syntax=docker/dockerfile:1.10# Base image only; pnpm self-manages to the `packageManager` version in package.json.ARG PNPM_VERSION=12.14.0@@ -30,7 +30,14 @@ RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store,sharing=locked \COPY --from=pruner /app/out/full/ ./# The server build bundles the published agent skills, which live outside any workspace package and so outside the prune.COPY --from=pruner /app/plugins/reactive-resume/skills ./plugins/reactive-resume/skills-RUN rm -rf apps/web/dist apps/web/dist-prerender apps/server/dist && pnpm turbo run build --filter=web --filter=server --force+# Turbo hashes these root files as a checkout has them; prune rewrites package.json and leaves the rest out.+# .gitignore keeps node_modules out of the hashes, as git does.+COPY --from=pruner /app/package.json /app/.gitignore /app/vite.config.ts /app/vitest.setup.ts /app/vitest.shared.mts ./+# With TURBO_TEAM and a TURBO_TOKEN secret, builds reuse and share Turbo's remote cache; without them, they build.+# The token is a secret mount: build args are recorded in the published provenance.+ARG TURBO_TEAM+RUN --mount=type=secret,id=TURBO_TOKEN,env=TURBO_TOKEN \+ TURBO_TEAM=${TURBO_TEAM} pnpm turbo run build --filter=web --filter=serverFROM base AS runtime-prunerCOPY . .diff --git a/turbo.json b/turbo.jsonindex 159174d80..9cdea2f41 100644--- a/turbo.json+++ b/turbo.json@@ -59,7 +59,7 @@"dependsOn": ["^transit"]},"build": {- "inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/.env*"],+ "inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/package.json", "$TURBO_ROOT$/.env*", "!$TURBO_ROOT$/.env.example"],"outputs": ["dist/**", ".vercel/**"],"dependsOn": ["transit"],"env": ["NODE_ENV"]