forked from enliven17/talos-stellar
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (110 loc) · 3.98 KB
/
Copy pathdeploy.yml
File metadata and controls
131 lines (110 loc) · 3.98 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Deploy Web → Vercel
on:
push:
branches: [main]
paths:
- 'web/**'
- 'packages/sdk/**'
pull_request:
branches: [main]
paths:
- 'web/**'
- 'packages/sdk/**'
permissions:
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_DB: talos_test
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/talos_test
DIRECT_URL: postgresql://postgres:postgres@localhost:5432/talos_test
STELLAR_NETWORK: testnet
STELLAR_HORIZON_URL: https://horizon-testnet.stellar.org
STELLAR_RPC_URL: https://soroban-testnet.stellar.org
NEXT_PUBLIC_STELLAR_NETWORK: testnet
NEXT_PUBLIC_STELLAR_RPC_URL: https://soroban-testnet.stellar.org
STELLAR_OPERATOR_SECRET_KEY: SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NEXT_PUBLIC_TALOS_REGISTRY_CONTRACT: CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NEXT_PUBLIC_TALOS_NAME_SERVICE_CONTRACT: CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: pnpm/action-setup@v4
with:
version: 10.0.0
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('web/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm tsc --noEmit
- name: Lint
run: pnpm lint
- name: Run database migrations
run: pnpm db:migrate
- name: Start Next.js development server
run: pnpm dev > next-dev.log 2>&1 &
- name: Wait for server to start
run: |
for i in {1..60}; do
if curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/health | grep -qE "200|503"; then
echo "Server is up!"
exit 0
fi
echo "Waiting for server to start..."
sleep 2
done
echo "Server failed to start! Printing logs:"
cat next-dev.log
exit 1
shell: bash
- name: Run E2E and Unit Tests
run: pnpm test
# Deploy to Vercel (main branch only, using Vercel CLI)
- name: Install Vercel CLI
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: npm install -g vercel@latest
- name: Pull Vercel environment
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Build project
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Deploy prebuilt to Vercel
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}