mirror your GitHub repos to tangled.org automatically
1# Deploy to Vercel.
2#
3# Pushes to `main` ship to production; pull requests targeting `main` get a
4# preview deployment. The Vercel CLI pulls project settings + env from Vercel,
5# builds locally, then uploads the prebuilt `.vercel/output`.
6when:
7 - event: ["push"]
8 branch: ["main"]
9 - event: ["pull_request"]
10 branch: ["main"]
11engine: microvm
12image: nixos
13dependencies:
14 - pnpm
15 - nodejs
16steps:
17 - name: "Install dependencies"
18 command: pnpm install --frozen-lockfile
19
20 - name: "Deploy"
21 command: |
22 set -euo pipefail
23
24 if [ "$TANGLED_REF_NAME" = "main" ]; then
25 target="production"
26 prod_flag="--prod"
27 else
28 target="preview"
29 prod_flag=""
30 fi
31
32 pnpm dlx vercel@latest pull --yes --environment="$target" --token="$VERCEL_TOKEN"
33 pnpm dlx vercel@latest build $prod_flag --token="$VERCEL_TOKEN"
34 pnpm dlx vercel@latest deploy --prebuilt $prod_flag --token="$VERCEL_TOKEN"