-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (55 loc) · 2.14 KB
/
Copy pathdeploy.yml
File metadata and controls
65 lines (55 loc) · 2.14 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
60
61
62
63
64
65
name: Deploy
# Vercel GitHub integration deploys on every push to main automatically.
# This workflow is manual-only to avoid failure emails when VERCEL_TOKEN is unset.
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Require Vercel token
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: |
if [ -z "$VERCEL_TOKEN" ]; then
echo "VERCEL_TOKEN secret is not set. Add it at vercel.com/account/tokens, then re-run this workflow."
exit 1
fi
- uses: actions/setup-node@v4
with:
node-version: "24"
cache: npm
- name: Install Vercel CLI
run: npm i -g vercel@56.4.1
- name: Pull Vercel settings
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Deploy preview first
id: preview
run: |
url=$(vercel deploy --token=${{ secrets.VERCEL_TOKEN }} --yes)
echo "url=$url" >> "$GITHUB_OUTPUT"
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Smoke test preview
run: |
sleep 10
BASE_URL=${{ steps.preview.outputs.url }} npm run test:smoke
curl -sf --max-time 5 "${{ steps.preview.outputs.url }}/api/health" >/dev/null
curl -sf --max-time 5 "${{ steps.preview.outputs.url }}/api/ready" >/dev/null
- name: Promote preview to production
id: deploy
run: |
vercel promote ${{ steps.preview.outputs.url }} --token=${{ secrets.VERCEL_TOKEN }} --yes
echo "url=${{ steps.preview.outputs.url }}" >> "$GITHUB_OUTPUT"
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Smoke test production alias
run: |
sleep 10
BASE_URL=https://medcore-research-builder.vercel.app npm run test:smoke