Skip to content

Commit 17072ab

Browse files
committed
Gha I hope
1 parent b92b8d8 commit 17072ab

File tree

7 files changed

+184
-57
lines changed

7 files changed

+184
-57
lines changed

.github/workflows/deploy.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Deploy Workflow - Copy to .github/workflows/deploy.yml to activate
2+
#
3+
# Prerequisites:
4+
# 1. Set up a self-hosted GitHub Actions runner on EC2
5+
# 2. Runner must have access to: pnpm, pm2, and the app directory
6+
#
7+
# Triggers on push to main, runs CI first, then deploys on success.
8+
9+
name: Deploy
10+
11+
on:
12+
push:
13+
branches: [main]
14+
15+
jobs:
16+
deploy:
17+
name: Deploy to Production
18+
runs-on: self-hosted
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Deploy to production
22+
run: ./deployment/deploy.sh
23+
env:
24+
NODE_ENV: production

apps/frontend/vite.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ export default defineConfig({
66
plugins: [tailwindcss(), sveltekit()],
77
server: {
88
host: true, // Listen on all network interfaces (accessible via local IP)
9+
allowedHosts: ['spot.tigerapps.org'],
910
fs: {
1011
// Allow serving files from the monorepo root node_modules
1112
allow: ['../..']
1213
}
14+
},
15+
preview: {
16+
allowedHosts: ['spot.tigerapps.org']
1317
}
1418
});

deployment/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ sudo systemctl reload nginx
369369

370370
## Step 5: Set Up SSL with Certbot
371371

372-
```bash
373-
sudo certbot --nginx -d YOUR_DOMAIN.com -d www.YOUR_DOMAIN.com
372+
````bash
373+
sudo certbot --nginx -d spot.tigerapps.org
374374
```
375375

376376
Follow the prompts:
@@ -389,7 +389,7 @@ Certbot will:
389389
390390
```bash
391391
sudo certbot renew --dry-run
392-
```
392+
````
393393
394394
---
395395

deployment/deploy.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,25 @@ git reset --hard origin/main
2222

2323
# Install dependencies
2424
echo ">>> Installing dependencies..."
25-
pnpm install --frozen-lockfile
25+
pnpm install --frozen-lockfile -r
2626

2727
# Backend: Generate Prisma client and run migrations
2828
echo ">>> Running database migrations..."
2929
cd apps/server
30+
pnpm i
31+
cd ../../
3032
pnpm db:generate
31-
pnpm prisma migrate deploy
33+
pnpm db:migrate
3234

3335
# Backend: Build TypeScript
3436
echo ">>> Building backend..."
37+
cd apps/server
3538
pnpm build
3639

3740
# Frontend: Build SvelteKit
3841
echo ">>> Building frontend..."
3942
cd ../frontend
43+
pnpm i
4044
pnpm build
4145

4246
# Restart PM2 with zero-downtime reload

deployment/github-actions/ci.yml

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,56 +26,10 @@ jobs:
2626

2727
- uses: actions/setup-node@v4
2828
with:
29-
node-version: "20"
30-
cache: "pnpm"
29+
node-version: '20'
30+
cache: 'pnpm'
3131

3232
- run: pnpm install
3333

3434
- name: Check formatting
3535
run: pnpm format:check
36-
37-
typecheck:
38-
name: Type Check
39-
runs-on: ubuntu-latest
40-
steps:
41-
- uses: actions/checkout@v4
42-
43-
- uses: pnpm/action-setup@v4
44-
with:
45-
version: 9
46-
47-
- uses: actions/setup-node@v4
48-
with:
49-
node-version: "20"
50-
cache: "pnpm"
51-
52-
- run: pnpm install
53-
54-
- name: Type check frontend
55-
run: pnpm --filter tigerspot-new check
56-
57-
- name: Type check backend
58-
run: pnpm --filter tigerspot-server build
59-
60-
build:
61-
name: Build
62-
runs-on: ubuntu-latest
63-
steps:
64-
- uses: actions/checkout@v4
65-
66-
- uses: pnpm/action-setup@v4
67-
with:
68-
version: 9
69-
70-
- uses: actions/setup-node@v4
71-
with:
72-
node-version: "20"
73-
cache: "pnpm"
74-
75-
- run: pnpm install
76-
77-
- name: Generate Prisma client
78-
run: pnpm --filter tigerspot-server db:generate
79-
80-
- name: Build frontend
81-
run: pnpm build

deployment/github-actions/deploy.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ on:
1313
branches: [main]
1414

1515
jobs:
16-
ci:
17-
name: Run CI Checks
18-
uses: ./.github/workflows/ci.yml
19-
2016
deploy:
2117
name: Deploy to Production
2218
needs: ci

0 commit comments

Comments
 (0)