Skip to content

Commit 67d6d90

Browse files
authored
Merge branch 'main' into fix/type-safety-event-ts
Signed-off-by: Srejoye Saha <sahasrejoye2005@gmail.com>
2 parents adbb198 + f819079 commit 67d6d90

28 files changed

Lines changed: 1886 additions & 561 deletions

File tree

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ MOBILE_REDIRECT_URI=devcard://oauth/callback
3232

3333
# ─── Server ───
3434
PORT=3000
35-
NODE_ENV=development
35+
NODE_ENV=development
36+
37+
# ─── Refresh Token Cleanup ───
38+
REFRESH_TOKEN_CLEANUP_INTERVAL_MS=86400000

.github/pull_request_template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ Closes #
4343

4444
## Checklist
4545

46-
- [ ] My code follows the project's coding style (`pnpm -r run lint` passes).
47-
- [ ] TypeScript compiles without errors (`pnpm -r run typecheck`).
46+
- [ ] My code follows the project's coding style (`npm run lint` passes).
47+
- [ ] TypeScript compiles without errors (`npm run typecheck --workspaces --if-present`).
4848
- [ ] I have added or updated tests for the changes I made.
49-
- [ ] All tests pass locally (`pnpm -r run test`).
49+
- [ ] All tests pass locally (`npm run test --workspaces --if-present`).
5050
- [ ] I have updated documentation where necessary.
5151
- [ ] No new `console.log` or debug statements left in the code.
5252
- [ ] Breaking changes are documented in this PR description.

.github/workflows/uat.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: UAT Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
detect-changes:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
backend: ${{ steps.changes.outputs.backend }}
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: dorny/paths-filter@v3
16+
id: changes
17+
with:
18+
filters: |
19+
backend:
20+
- 'apps/backend/**'
21+
22+
backend-deploy:
23+
needs: detect-changes
24+
if: needs.detect-changes.outputs.backend == 'true'
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
id-token: write
29+
30+
steps:
31+
- name: Checkout app repo
32+
uses: actions/checkout@v4
33+
34+
- name: Checkout infra repo
35+
uses: actions/checkout@v4
36+
with:
37+
repository: Dev-Card/devcard-infra
38+
path: infra
39+
token: ${{ secrets.INFRA_REPO_TOKEN }}
40+
41+
- name: Authenticate to GCP
42+
uses: google-github-actions/auth@v2
43+
with:
44+
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
45+
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}
46+
47+
- name: Setup gcloud
48+
uses: google-github-actions/setup-gcloud@v2
49+
50+
- name: Configure Docker for Artifact Registry
51+
run: gcloud auth configure-docker asia-south1-docker.pkg.dev
52+
53+
- name: Set image tag
54+
id: tag
55+
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 20
61+
cache: npm
62+
cache-dependency-path: apps/backend/package-lock.json
63+
64+
- name: Install dependencies
65+
working-directory: apps/backend
66+
run: npm ci
67+
68+
# TODO: Once tests are fixed, uncomment the following lines
69+
# - name: Run tests
70+
# working-directory: apps/backend
71+
# run: npm test
72+
73+
- name: Build and push Docker image
74+
run: |
75+
docker build \
76+
-f docker/backend.Dockerfile \
77+
-t asia-south1-docker.pkg.dev/devcard-prod/devcard/backend:${{ steps.tag.outputs.sha }} \
78+
.
79+
docker push asia-south1-docker.pkg.dev/devcard-prod/devcard/backend:${{ steps.tag.outputs.sha }}
80+
81+
- name: Get GKE credentials
82+
uses: google-github-actions/get-gke-credentials@v2
83+
with:
84+
cluster_name: devcard-cluster
85+
location: asia-south1
86+
87+
- name: Run Prisma migrations
88+
run: |
89+
cat <<EOF | kubectl apply -f -
90+
apiVersion: batch/v1
91+
kind: Job
92+
metadata:
93+
name: prisma-migrate-${{ steps.tag.outputs.sha }}
94+
namespace: uat
95+
spec:
96+
ttlSecondsAfterFinished: 300
97+
template:
98+
spec:
99+
restartPolicy: Never
100+
containers:
101+
- name: migrate
102+
image: asia-south1-docker.pkg.dev/devcard-prod/devcard/backend:${{ steps.tag.outputs.sha }}
103+
command: ["npx", "prisma", "migrate", "deploy"]
104+
env:
105+
- name: DATABASE_URL
106+
valueFrom:
107+
secretKeyRef:
108+
name: devcard-secret
109+
key: database-url
110+
EOF
111+
kubectl wait --for=condition=complete \
112+
job/prisma-migrate-${{ steps.tag.outputs.sha }} \
113+
-n uat --timeout=120s
114+
115+
- name: Update image tag in kustomize
116+
run: |
117+
cd infra/k8s/overlays/uat
118+
kustomize edit set image IMAGE_TAG_PLACEHOLDER=asia-south1-docker.pkg.dev/devcard-prod/devcard/backend:${{ steps.tag.outputs.sha }}
119+
120+
- name: Commit and push image tag to infra repo
121+
run: |
122+
cd infra
123+
git config user.name "github-actions[bot]"
124+
git config user.email "github-actions[bot]@users.noreply.github.com"
125+
git add k8s/overlays/uat/kustomization.yaml
126+
git commit -m "chore: update uat backend image to ${{ steps.tag.outputs.sha }}"
127+
git push
128+
129+
- name: Deploy to UAT
130+
run: kubectl apply -k infra/k8s/overlays/uat
131+
132+
- name: Wait for rollout
133+
run: |
134+
kubectl rollout status deployment/backend \
135+
-n uat --timeout=5m

apps/backend/prisma/migrations/20260312125106_init/migration.sql

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

apps/backend/prisma/migrations/20260312162249_analytics_models/migration.sql

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

0 commit comments

Comments
 (0)