Skip to content

Commit a2226cf

Browse files
authored
Turborepo + GHA example without --prebuilt . (#942)
### 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)
1 parent 457036d commit a2226cf

File tree

5 files changed

+89
-1
lines changed

5 files changed

+89
-1
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
env:
3+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
5+
# For Remote Caching
6+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
7+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
8+
9+
on:
10+
pull_request:
11+
branches: ['main']
12+
types: [opened, synchronize]
13+
14+
jobs:
15+
build:
16+
name: Build and Deploy
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Check out code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 2
24+
25+
- uses: pnpm/action-setup@v3
26+
with:
27+
version: 8
28+
29+
- name: Setup Node.js environment
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
cache: 'pnpm'
34+
35+
- name: Install dependencies
36+
run: pnpm install
37+
38+
- name: Globally install Turborepo
39+
run: pnpm install -g turbo@^2
40+
41+
- name: Build and Deploy
42+
run: |
43+
vercel deploy --token=${{ secrets.VERCEL_TOKEN }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
env:
3+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
5+
# For Remote Caching
6+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
7+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
8+
9+
on:
10+
push:
11+
branches: ['main']
12+
13+
jobs:
14+
build:
15+
name: Build and Deploy
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Check out code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 2
23+
24+
- uses: pnpm/action-setup@v3
25+
with:
26+
version: 8
27+
28+
- name: Setup Node.js environment
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
cache: 'pnpm'
33+
34+
- name: Install dependencies
35+
run: pnpm install
36+
37+
- name: Globally install Turborepo
38+
run: pnpm install -g turbo@^2
39+
40+
- name: Build and Deploy
41+
run: |
42+
vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

ci-cd/turborepo-github-actions/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

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

5-
It uses a GitHub Actions workflow to build and deploy the `docs` application.
5+
It uses a GitHub Actions workflows to build and deploy applications.
6+
7+
- `web` is built using `vc deploy` to build and deploy on Vercel.
8+
- `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.
69

710
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 commit comments

Comments
 (0)