-
Notifications
You must be signed in to change notification settings - Fork 2
29 lines (28 loc) · 983 Bytes
/
preview.yml
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
name: Deploy PR to Preview
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
pull_request:
branches:
[main, dev]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install Vercel CLI
run: npm install --global vercel@latest
- name: pull Vercel environment information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: build project artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy preview
id: preview-deploy
run: echo "URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | tail -n 1)" >> $GITHUB_OUTPUT
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Preview URL ${{ steps.preview-deploy.outputs.URL }}
comment_tag: execution