forked from sleepypod/core
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 1.74 KB
/
openapi.yml
File metadata and controls
69 lines (57 loc) · 1.74 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
name: Publish OpenAPI Spec
on:
push:
branches: [main, dev]
permissions:
contents: read
jobs:
publish-spec:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Start server
run: |
mkdir -p /tmp/sleepypod-raw
pnpm start > /tmp/server.log 2>&1 &
echo "SERVER_PID=$!" >> "$GITHUB_ENV"
env:
DATABASE_URL: file:./ci-sleepypod.db
BIOMETRICS_DATABASE_URL: file:./ci-biometrics.db
RAW_DATA_DIR: /tmp/sleepypod-raw
DAC_SOCK_PATH: /tmp/nonexistent-dac.sock
- name: Wait for server
run: |
for i in $(seq 1 90); do
if curl -sf http://localhost:3000/api/openapi.json > /dev/null 2>&1; then
echo "Server ready after ${i}s"
exit 0
fi
sleep 1
done
echo "Server failed to start within 90s"
echo "--- Server log ---"
cat /tmp/server.log
exit 1
- name: Download OpenAPI spec
run: curl -sf http://localhost:3000/api/openapi.json | jq . > openapi.json
- name: Stop server
if: always()
run: kill "$SERVER_PID" 2>/dev/null || true
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ github.ref_name == 'main' && 'openapi' || 'openapi-dev' }}
path: openapi.json
retention-days: 90