Repository navigation
59 lines (52 loc) · 2.11 KB
/
Copy pathstaging-deploy.yml
File metadata and controls
59 lines (52 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Staging Deploy
# Deploys the docs site to the staging environment (staging.navrouter.dev) on every push to main that
# touches the site or the packages it documents. Builds here and ships prebuilt, so Vercel runs no
# build. Vercel's own Git deploys are off (docs/vercel.json); this and release-deploy.yml are the
# only ways into an environment. Same flow as Semantic-Org/Semantic-Next.
# Requires: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_NAVROUTER_PROJECT_ID
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'packages/**'
- 'package-lock.json'
- '.github/workflows/staging-deploy.yml'
concurrency:
# a newer main push supersedes an in-flight staging build
group: staging-deploy
cancel-in-progress: true
permissions:
contents: read
jobs:
docs:
name: Deploy docs to staging
runs-on: ubuntu-latest
timeout-minutes: 15
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_NAVROUTER_PROJECT_ID }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: '.node-version'
cache: 'npm'
# astro's incremental cache, shared with the release deploy
- uses: actions/cache@v6
with:
path: docs/node_modules/.astro
key: docs-astro-${{ runner.os }}-${{ github.sha }}
restore-keys: |
docs-astro-${{ runner.os }}-
# from the repo root: the project's Root Directory is docs/, which vercel applies relative to
# the working directory. --environment names the custom environment for all three steps.
# `vercel build` runs the project's install and `npm run build`, which syncs the sandbox
# first, so the output matches a remote build
- name: Build and deploy docs to staging
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: |
npx vercel pull --yes --environment=staging --token="$VERCEL_TOKEN"
npx vercel build --environment=staging --token="$VERCEL_TOKEN"
npx vercel deploy --prebuilt --environment=staging --token="$VERCEL_TOKEN"