-
Notifications
You must be signed in to change notification settings - Fork 4
77 lines (65 loc) · 2.45 KB
/
deploy.yml
File metadata and controls
77 lines (65 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: npm ci
- name: Lint
run: npx nx run-many -t lint --parallel=3
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Open database proxy
run: |
flyctl proxy 5434:5432 --app teerankio-postgres2 &
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_POSTGRES2 }}
- name: Open redis proxy
run: |
flyctl proxy 6379:6379 --app teerankio-redis &
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_REDIS }}
- name: Migrate database
run: |
sleep 2
npx prisma generate --sql --schema=libs/prisma/prisma/schema.prisma
npx nx run-many -t prisma-deploy --parallel=4
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_POSTGRES2 }}
PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]'
- name: Build
run: npx nx run-many -t build --configuration=production --parallel=4
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Test
run: |
npx nx run prisma:prisma-push
npx nx run-many -t test
env:
PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]'
- name: Deploy frontend
run: flyctl deploy --config apps/frontend/fly.toml --dockerfile apps/frontend/Dockerfile
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_FRONTEND }}
PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]'
- name: Deploy worker
run: flyctl deploy --config apps/worker/fly.toml --dockerfile apps/worker/Dockerfile
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_WORKER }}
PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]'
- name: Deploy scheduler
run: flyctl deploy --config apps/scheduler/fly.toml --dockerfile apps/scheduler/Dockerfile
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_SCHEDULER }}
PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]'