Skip to content

Commit 2ccc661

Browse files
Block vercel deployment on test success
1 parent 7b08461 commit 2ccc661

File tree

3 files changed

+69
-4
lines changed

3 files changed

+69
-4
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Vercel Preview Deployment
2+
3+
env:
4+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
5+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
6+
7+
on:
8+
pull_request:
9+
branches: [ "master" ]
10+
workflow_dispatch:
11+
12+
jobs:
13+
test:
14+
uses: ./.github/workflows/tests.yml
15+
16+
deploy-preview:
17+
needs: [test]
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Install Vercel CLI
25+
run: npm install --global vercel@canary
26+
27+
- name: Pull Vercel Environment Information
28+
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
29+
30+
- name: Build Project Artifacts
31+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
32+
33+
- name: Deploy Project Artifacts to Vercel
34+
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Vercel Production Deployment
2+
3+
env:
4+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
5+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
6+
7+
on:
8+
push:
9+
branches: [ "master" ]
10+
workflow_dispatch:
11+
12+
jobs:
13+
test:
14+
uses: ./.github/workflows/tests.yml
15+
16+
deploy-production:
17+
needs: [test]
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Install Vercel CLI
25+
run: npm install --global vercel@canary
26+
27+
- name: Pull Vercel Environment Information
28+
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
29+
30+
- name: Build Project Artifacts
31+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
32+
33+
- name: Deploy Project Artifacts to Vercel
34+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

.github/workflows/tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: Tests
22

33
on:
4-
push:
5-
branches: [ "master" ]
6-
pull_request:
7-
branches: [ "master" ]
4+
workflow_call:
85
workflow_dispatch:
96

107
jobs:

0 commit comments

Comments
 (0)