I'm aware of https://github.com/vercel/examples/tree/main/ci-cd/github-actions
but I cannot find a working example of a turborepo/monorepo deploying a nextjs application
I've failed for over 48 hours now attempting to wrestle with the vercel cli to get this deployed - a maintained example by the vercel team would be appreciated...
here is my very simple github action...
name: Beta Deployment
on: push: branches: ["canary"]
env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs: deploy: runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v4 with: fetch-depth: 2
- uses: pnpm/action-setup@v4 with: version: 10.7.1 run_install: false
- uses: actions/setup-node@v4 with: cache: "pnpm" node-version: 22
# Add Turborepo cache - name: Cache Turborepo uses: actions/cache@v4 with: path: .turbo key: ${{ runner.os }}-turbo-${{ github.sha }} restore-keys: | ${{ runner.os }}-turbo-
- name: Install dependencies run: pnpm install
- name: Install Vercel CLI run: pnpm add -g vercel@latest
- name: Pull Vercel Environment Information run: pnpm --filter="@app/www" exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts run: pnpm --filter="@app/www" exec vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel run: pnpm --filter="@app/www" exec vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}here's where it fails
Run pnpm --filter="@***/www" exec vercel build --prod --token=*** pnpm --filter="@***/www" exec vercel build --prod --token=*** shell: /usr/bin/bash -e {0} env: TURBO_TOKEN: *** TURBO_TEAM: *** DISCORD_WEBHOOK: *** VERCEL_ORG_ID: *** VERCEL_PROJECT_ID: *** OPENAI_API_KEY: *** PNPM_HOME: /home/runner/setup-pnpm/node_modules/.binVercel CLI 41.4.1> Detected ENABLE_EXPERIMENTAL_COREPACK=1 and "pnpm@10.7.1" in package.jsonRunning "install" command: `pnpm install`...Error: spawn sh ENOENTundefined/home/runner/work/monorepo/monorepo/apps/www: ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command failed with exit code 1: vercel build --prod --token=***I know the vercel cli is working, because the step before is successful
Run pnpm --filter="@***/www" exec vercel pull --yes --environment=production --token=***Vercel CLI 41.4.1> NOTE: The Vercel CLI now collects telemetry regarding usage of the CLI.> This information is used to shape the CLI roadmap and prioritize features.> You can learn more, including how to opt-out if you'd not like to participate in this program, by visiting the following URL:> https://vercel.com/docs/cli/about-telemetryRetrieving project…> Downloading `production` Environment Variables for ***/www-betaDownloadingCreated .vercel/.env.production.local file [123ms]
> Downloading project settingsDownloaded project settings to ~/work/monorepo/monorepo/apps/www/.vercel/project.json [0ms]I do have ENABLE_EXPERIMENTAL_COREPACK enabled, but this is only to pin the pnpm version, which is the installed version in this workflow...
please advise...
for reference:
- I've also tried to build the app locally within the action (it is successful), and deploying via the `--prebuilt`` option but what ends up getting deployed is a blank app.
- I've also tried building the app and then triggered deploy with vercel hoping that turborepo will have cached that build, that also fails.
I understand the desire to keep builds on vercel, but this is incredibly frustrating that there's not supported examples for what I would imagine would be a fairly common setup turborepo+nextjs+vercel-deployment
within a github action