-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (37 loc) · 1.41 KB
/
workflow.yaml
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
name: Workflow
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run fmt.check
- run: npm run build
- if: ${{ github.event_name == 'pull_request' }}
run: npx vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- if: ${{ github.event_name == 'pull_request' }}
run: echo "DEPLOYMENT_URL=$(npx vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> "$GITHUB_ENV"
- name: Post preview url comment on PR
if: ${{ github.event_name == 'pull_request' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
[Preview is deployed here](${{ env.DEPLOYMENT_URL }})
- if: github.ref == 'refs/heads/main'
run: npx vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- if: github.ref == 'refs/heads/main'
run: npx vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}