-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (142 loc) · 4.95 KB
/
Copy pathdatabase-docs.yml
File metadata and controls
166 lines (142 loc) · 4.95 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Database Documentation
on:
push:
branches: [main]
paths:
- 'build.gradle'
- 'src/main/java/**'
- 'src/main/resources/application.yaml'
- 'src/main/resources/db/migration/**'
- 'src/main/resources/db/migration-postgresql/**'
- 'scripts/api-docs/**'
- 'scripts/db-docs/**'
- '.github/workflows/database-docs.yml'
pull_request:
branches: [main]
paths:
- 'build.gradle'
- 'src/main/java/**'
- 'src/main/resources/application.yaml'
- 'src/main/resources/db/migration/**'
- 'src/main/resources/db/migration-postgresql/**'
- 'scripts/api-docs/**'
- 'scripts/db-docs/**'
- '.github/workflows/database-docs.yml'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: database-docs-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-docs:
name: Build database documentation
runs-on: ubuntu-latest
timeout-minutes: 15
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: fowoco_docs
POSTGRES_USER: fowoco_docs
POSTGRES_PASSWORD: fowoco_docs_ci_only
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U fowoco_docs -d fowoco_docs"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Set up Node.js 24
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: '24'
- name: Test documentation generator
run: node --test scripts/db-docs/generate-site.test.mjs
- name: Generate database documentation
run: ./scripts/db-docs/generate.sh
env:
DB_DOCS_CONTAINER_HOST: 127.0.0.1
DB_DOCS_EPHEMERAL: 'true'
DB_DOCS_PORT: '5432'
DB_DOCS_DATABASE: fowoco_docs
DB_DOCS_USER: fowoco_docs
DB_DOCS_PASSWORD: fowoco_docs_ci_only
DB_DOCS_GIT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Upload database documentation preview
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: database-docs-site
path: build/db-docs/site
if-no-files-found: error
retention-days: 14
build-api-docs:
name: Build API documentation
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Set up Java 17
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
with:
distribution: temurin
java-version: '17'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6
- name: Set up Node.js 24
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: '24'
- name: Test API documentation generator
run: node --test scripts/api-docs/generate-site.test.mjs
- name: Generate API documentation
run: ./scripts/api-docs/generate.sh
env:
API_DOCS_GIT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
API_DOCS_SERVER_URL: ${{ vars.SERVER_PUBLIC_URL }}
- name: Upload API documentation preview
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: api-docs-site
path: build/api-docs/site
if-no-files-found: error
retention-days: 14
deploy-pages:
name: Deploy server documentation
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- build-docs
- build-api-docs
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download database documentation
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: database-docs-site
path: site
- name: Download API documentation
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: api-docs-site
path: site/api
- name: Configure GitHub Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
with:
path: site
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4