Skip to content

Commit db4a3d9

Browse files
authored
Merge pull request #12 from techstartucalgary/CD-pipeline-for-backend-deploying-to-vercel
CD pipeline for backend deploying to vercel
2 parents ec0a670 + c380c66 commit db4a3d9

File tree

3 files changed

+58
-9
lines changed

3 files changed

+58
-9
lines changed

.github/workflows/backend.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
name: Build and Deploy Backend
22

33
on:
4-
push:
5-
branches: [main]
6-
paths:
7-
- 'shatter-backend/**'
8-
9-
pull_request:
10-
branches: [main]
11-
paths:
12-
- 'shatter-backend/**'
4+
# push:
5+
# branches: [main]
6+
# paths:
7+
# - 'shatter-backend/**'
8+
9+
# pull_request:
10+
# branches: [main]
11+
# paths:
12+
# - 'shatter-backend/**'
13+
workflow_dispatch:
1314

1415
jobs:
1516
build:

.github/workflows/cd-backend.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CD - Deploy Backend to Vercel
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
build_number:
7+
description: 'CI Build Number to Deploy'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Download build artifact
20+
uses: actions/download-artifact@v4
21+
with:
22+
name: node-backend-${{ inputs.build_number }}
23+
path: ./artifacts
24+
25+
- name: Extract artifact
26+
run: |
27+
cd artifacts
28+
tar -xzf node-backend-${{ inputs.build_number }}.tar.gz
29+
ls -la output
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: "20"
35+
36+
- name: Install Vercel CLI
37+
run: npm install -g vercel
38+
39+
- name: Deploy to Vercel
40+
env:
41+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
42+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_BACKEND }}
43+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_BACKEND }}
44+
run: |
45+
cd artifacts/output
46+
vercel pull --yes --environment=production --token=$VERCEL_TOKEN
47+
vercel deploy --prod --token=$VERCEL_TOKEN > deployment-url.txt

shatter-backend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ dist-ssr
2424
*.sw?
2525

2626
.env
27+
.vercel

0 commit comments

Comments
 (0)