Skip to content

Commit c05d2fb

Browse files
Create main.yml
1 parent 0fe1351 commit c05d2fb

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/main.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Deploy and Run E2E Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
deploy:
11+
name: Deploy to Vercel
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v3
17+
18+
- name: Install Vercel CLI
19+
run: npm install -g vercel
20+
21+
- name: Deploy to Vercel
22+
id: deploy
23+
run: |
24+
vercel pull --yes --environment=preview --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }}
25+
DEPLOY_URL=$(vercel deploy --prod --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | tail -1)
26+
echo "DEPLOYMENT_URL=${DEPLOY_URL}" >> $GITHUB_ENV
27+
echo "Deployed to: $DEPLOY_URL"
28+
29+
env:
30+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
31+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
32+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN_MY_PROJECT }}
33+
34+
e2e:
35+
name: Run E2E Tests
36+
runs-on: ubuntu-latest
37+
needs: deploy
38+
39+
steps:
40+
- name: Checkout Code
41+
uses: actions/checkout@v3
42+
43+
- name: Install Dependencies
44+
run: npm install
45+
46+
- name: Install Playwright
47+
run: npx playwright install
48+
49+
- name: Run Playwright Tests
50+
run: npx playwright test
51+
env:
52+
BASE_URL: ${{ env.DEPLOYMENT_URL }}

0 commit comments

Comments
 (0)