Skip to content

Commit 3eef401

Browse files
Remove obsolete deployment workflows and update main CI/CD workflow for conditional deployment based on event type
1 parent 19d53e2 commit 3eef401

File tree

3 files changed

+29
-90
lines changed

3 files changed

+29
-90
lines changed

.github/workflow/deploy-e2e.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflow/deploy.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
name: Deploy and Run E2E Tests
1+
name: CI/CD Workflow--> Deploy and run E2E tests
22

33
on:
4+
pull_request:
45
push:
56
branches:
67
- main
7-
pull_request:
8+
release:
9+
types: [created]
810

911
jobs:
1012
deploy:
@@ -22,13 +24,14 @@ jobs:
2224
id: deploy
2325
run: |
2426
vercel pull --yes --environment=preview --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }}
25-
DEPLOY_URL=$(vercel deploy --staging --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | tail -1)
27+
if [[ "${{ github.event_name }}" == "release" ]]; then
28+
DEPLOY_URL=$(vercel deploy --prod --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | tail -1)
29+
else
30+
DEPLOY_URL=$(vercel deploy --staging --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | tail -1)
31+
fi
2632
echo "DEPLOYMENT_URL=${DEPLOY_URL}" >> $GITHUB_ENV
2733
echo "Deployed to: $DEPLOY_URL"
28-
2934
env:
30-
# VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
31-
# VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
3235
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN_MY_PROJECT }}
3336

3437
e2e:
@@ -41,12 +44,28 @@ jobs:
4144
uses: actions/checkout@v3
4245

4346
- name: Install Dependencies
44-
run: npm install
47+
run: pnpm install
4548

46-
- name: Install Playwright
47-
run: npx playwright install
49+
- name: Install Playwright
50+
run: pnpm playwright install
4851

4952
- name: Run Playwright Tests
50-
run: npx playwright test
53+
run: pnpm playwright test
5154
env:
5255
BASE_URL: ${{ env.DEPLOYMENT_URL }}
56+
57+
# notify:
58+
# name: Send Slack Notification
59+
# runs-on: ubuntu-latest
60+
# needs: [deploy, e2e]
61+
# if: failure()
62+
# steps:
63+
# - name: Notify Slack
64+
# uses: slackapi/[email protected]
65+
# with:
66+
# payload: |
67+
# {
68+
# "text": "Workflow failed for branch: ${{ github.ref_name }}. Please check the logs for details."
69+
# }
70+
# env:
71+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)