Skip to content

Commit

Permalink
Turborepo + GHA example without --prebuilt . (#942)
Browse files Browse the repository at this point in the history
### Description

Adding a workflow that only uses `vc deploy`, rather than `--prebuilt`,
as an example of the flexibility you have with Vercel CLI.

### Type of Change

- [ ] New Example
- [x] Example updates (Bug fixes, new features, etc.)
- [ ] Other (changes to the codebase, but not to examples)
  • Loading branch information
anthonyshew authored Jul 25, 2024
1 parent 457036d commit a2226cf
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 1 deletion.
43 changes: 43 additions & 0 deletions ci-cd/turborepo-github-actions/.github/workflows/preview-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
# For Remote Caching
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

on:
pull_request:
branches: ['main']
types: [opened, synchronize]

jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Globally install Turborepo
run: pnpm install -g turbo@^2

- name: Build and Deploy
run: |
vercel deploy --token=${{ secrets.VERCEL_TOKEN }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
# For Remote Caching
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

on:
push:
branches: ['main']

jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Globally install Turborepo
run: pnpm install -g turbo@^2

- name: Build and Deploy
run: |
vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
5 changes: 4 additions & 1 deletion ci-cd/turborepo-github-actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This demo is based on the [Turborepo starter](https://github.com/vercel/turbo/tree/main/examples/basic).

It uses a GitHub Actions workflow to build and deploy the `docs` application.
It uses a GitHub Actions workflows to build and deploy applications.

- `web` is built using `vc deploy` to build and deploy on Vercel.
- `docs` is built using `vc build` and `vc deploy --prebuilt` to show how you can take more control of your build and deploy process. This process builds the application in the GitHub Action, and then deploys those prebuilt assets to Vercel.

Additionally, a `foo` internal package has been added to demonstrate how to use the `turbo` CLI to build internal dependencies prior to building the `docs` application with the Vercel CLI.

0 comments on commit a2226cf

Please sign in to comment.