Skip to content

Commit 7bf32a1

Browse files
authored
Update deploy.yml
hkr
1 parent 6258d3c commit 7bf32a1

File tree

1 file changed

+9
-70
lines changed

1 file changed

+9
-70
lines changed

.github/workflows/deploy.yml

Lines changed: 9 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,19 @@ name: Deploy to Vercel
22
on:
33
push:
44
branches: [main]
5-
pull_request:
6-
branches: [main]
7-
8-
env:
9-
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
10-
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
11-
125
jobs:
136
deploy:
147
runs-on: ubuntu-latest
158
steps:
16-
- uses: actions/checkout@v4
17-
18-
- name: Setup Node.js
19-
uses: actions/setup-node@v3
20-
with:
21-
node-version: '18'
22-
9+
- name: Checkout code
10+
uses: actions/checkout@v4
11+
2312
- name: Install dependencies
24-
run: npm ci
25-
26-
- name: Install Vercel CLI
27-
run: npm install --global vercel@latest
28-
29-
- name: Pull Vercel Environment Information
30-
run: |
31-
if ${{ github.event_name == 'pull_request' }}; then
32-
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
33-
else
34-
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
35-
fi
36-
37-
- name: Build Project Artifacts
38-
run: |
39-
if ${{ github.event_name == 'pull_request' }}; then
40-
vercel build --token=${{ secrets.VERCEL_TOKEN }}
41-
else
42-
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
43-
fi
44-
45-
- name: Deploy Project Artifacts to Vercel
46-
id: deploy
47-
run: |
48-
if ${{ github.event_name == 'pull_request' }}; then
49-
echo "VERCEL_DEPLOYMENT_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_ENV
50-
else
51-
echo "VERCEL_DEPLOYMENT_URL=$(vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_ENV
52-
fi
53-
54-
- name: Add comment to PR
55-
if: github.event_name == 'pull_request'
56-
uses: actions/github-script@v6
57-
with:
58-
github-token: ${{ secrets.GITHUB_TOKEN }}
59-
script: |
60-
github.rest.issues.createComment({
61-
issue_number: context.issue.number,
62-
owner: context.repo.owner,
63-
repo: context.repo.repo,
64-
body: `🚀 Deployed to: ${process.env.VERCEL_DEPLOYMENT_URL}`
65-
})
13+
run: npm install
6614

67-
- name: Run linting
68-
run: npm run lint || true
69-
70-
- name: Run Lighthouse
71-
uses: treosh/lighthouse-ci-action@v9
72-
with:
73-
urls: |
74-
https://swifthost-web.vercel.app/
75-
uploadArtifacts: true
76-
temporaryPublicStorage: true
77-
78-
- name: Security scan
79-
uses: ShiftLeftSecurity/scan-action@master
15+
- name: Deploy to Vercel
16+
uses: amondnet/vercel-action@v25
8017
with:
81-
type: "nodejs"
18+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
19+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
20+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}

0 commit comments

Comments
 (0)