Skip to content

Commit 3884856

Browse files
authored
Add example of Turborepo, Vercel CLI, and GitHub Actions. (#940)
### Description # GitHub Actions + Turborepo + Vercel CLI 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. 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. ### Type of Change - [x] New Example - [ ] Example updates (Bug fixes, new features, etc.) - [ ] Other (changes to the codebase, but not to examples)
1 parent 000376c commit 3884856

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+7308
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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
42+
run: |
43+
# Builds the dependencies of the docs target
44+
# https://turbo.build/repo/docs/reference/run#microsyntaxes-for-filtering
45+
# We need to do this since `vc build` does not currently
46+
# follow the package or task graph (like Turborepo can).
47+
turbo build --filter=docs^...
48+
# Pull environment info
49+
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
50+
vercel build --token=${{ secrets.VERCEL_TOKEN }}
51+
52+
- name: Deploy
53+
run: |
54+
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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
41+
run: |
42+
# Builds the dependencies of the docs target
43+
# https://turbo.build/repo/docs/reference/run#microsyntaxes-for-filtering
44+
# We need to do this since `vc build` does not currently
45+
# follow the package or task graph (like Turborepo can).
46+
turbo build --filter=docs^...
47+
# Pull environment info
48+
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
49+
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
50+
51+
- name: Deploy
52+
run: |
53+
vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# Dependencies
4+
node_modules
5+
.pnp
6+
.pnp.js
7+
8+
# Local env files
9+
.env
10+
.env.local
11+
.env.development.local
12+
.env.test.local
13+
.env.production.local
14+
15+
# Testing
16+
coverage
17+
18+
# Turbo
19+
.turbo
20+
21+
# Vercel
22+
.vercel
23+
24+
# Build Outputs
25+
.next/
26+
out/
27+
build
28+
dist
29+
30+
31+
# Debug
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*
35+
36+
# Misc
37+
.DS_Store
38+
*.pem
39+
.env*.local

ci-cd/with-github-actions/.npmrc

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# GitHub Actions + Turborepo + Vercel CLI
2+
3+
This demo is based on the [Turborepo starter](https://github.com/vercel/turbo/tree/main/examples/basic).
4+
5+
It uses a GitHub Actions workflow to build and deploy the `docs` application.
6+
7+
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.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @type {import("eslint").Linter.Config} */
2+
module.exports = {
3+
root: true,
4+
extends: ["@repo/eslint-config/next.js"],
5+
parser: "@typescript-eslint/parser",
6+
parserOptions: {
7+
project: true,
8+
},
9+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# env files (can opt-in for commiting if needed)
29+
.env*
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load Inter, a custom Google Font.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
25.3 KB
Binary file not shown.
66.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)