Skip to content

Commit 7316420

Browse files
author
Your Name
committed
Initial commit with deployment workflow
0 parents  commit 7316420

File tree

14,664 files changed

+1993513
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

14,664 files changed

+1993513
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Deploy to Vercel
2+
on:
3+
push:
4+
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+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
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+
23+
- 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+
})
66+
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
80+
with:
81+
type: "nodejs"

0 commit comments

Comments
 (0)