Skip to content

Commit 29f7e63

Browse files
committed
update deploy document ci/cd
1 parent 7e99068 commit 29f7e63

17 files changed

Lines changed: 303 additions & 293 deletions

File tree

.github/workflows/build_and_deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and deploy when pushing on main
1+
name: Build and deploy
22

33
on:
44
push:

.github/workflows/deploy_documentation.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
name: Deploy Docusaurus to GitHub Pages
1+
name: Deploy documentation to GitHub Pages
22

33
on:
4-
push:
5-
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
8-
workflow_call: # Add this to make the workflow reusable
9-
workflow_dispatch: # Add this to allow manual triggering
4+
workflow_run:
5+
workflows: ["Release updates"]
6+
types: [completed]
7+
workflow_dispatch:
8+
workflow_call:
9+
workflow_dispatch:
1010

1111
jobs:
1212
deploy:
13+
if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'release') }}
1314
runs-on: ubuntu-latest
1415
permissions:
1516
contents: write
@@ -26,15 +27,9 @@ jobs:
2627

2728
- name: Install dependencies
2829
working-directory: ./docs
29-
run: npm ci
30+
run: npm install
3031

31-
- name: Fetch contributors
32-
working-directory: ./docs
33-
run: npm run fetch-contributors
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
37-
- name: Build Docusaurus site
32+
- name: Build documentation
3833
working-directory: ./docs
3934
run: npm run build
4035

.github/workflows/generate_documentation.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Release updates
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build and deploy"]
6+
types: [completed]
7+
workflow_dispatch:
8+
workflow_call:
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
release_updates:
16+
if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'release') }}
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout du code
21+
uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
24+
fetch-depth: 0
25+
26+
- name: Configure Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: '3.12'
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install ".[api,dev]"
35+
36+
- name: Update project version
37+
run: |
38+
git fetch --tags --force
39+
latest_version="$(git tag --sort=-version:refname | head -n 1)"
40+
if [ -z "$latest_version" ]; then
41+
echo "No git tags found. Skipping project version update."
42+
exit 0
43+
fi
44+
sed -i -E "s/^[[:space:]]*version[[:space:]]*=.*/version = \"${latest_version}\"/" pyproject.toml
45+
sed -i -E "s|(image:[[:space:]]*ghcr.io/etalab-ia/opengatellm/api:).*|\\1${latest_version}|" compose.example.yml
46+
sed -i -E "s|(image:[[:space:]]*ghcr.io/etalab-ia/opengatellm/playground:).*|\\1${latest_version}|" compose.example.yml
47+
sed -i -E "s/(badge:[[:space:]]*)'[^']*'/\1'v${latest_version}'/" docs/astro.config.mjs
48+
49+
- name: Generate documentation
50+
run: |
51+
PYTHONPATH=. python ./scripts/docs/generate_configuration_documentation.py --output ./docs/docs/getting-started/configuration_file.md
52+
make quickstart
53+
curl http://localhost:8000/openapi.json -o ./docs/openapi.json
54+
docker pull redocly/cli
55+
docker run --rm -v ${{ github.workspace }}/docs:/spec redocly/cli build-docs /spec/openapi.json --output /spec/redoc-static.html
56+
57+
- name: Create pull request for release updates
58+
uses: peter-evans/create-pull-request@v6
59+
with:
60+
commit-message: "chore(doc): update generated documentation and release versions"
61+
title: "chore(doc): update generated documentation and release versions"
62+
body: |
63+
Automated documentation and release version update after `Build and deploy` release workflow completion.
64+
branch: "ci/release-update-${{ github.event.workflow_run.id }}"
65+
base: "main"
66+
delete-branch: true
67+
add-paths: |
68+
docs/docs/getting-started/configuration_file.md
69+
docs/openapi.json
70+
docs/redoc-static.html
71+
docs/astro.config.mjs
72+
compose.example.yml
73+
pyproject.toml

.github/workflows/update_pyproject_version.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

api/schemas/core/configuration.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from enum import Enum
1+
from enum import StrEnum
22
from functools import wraps
33
import logging
44
import os
@@ -71,7 +71,7 @@ def resolve_model_for_error(model: type[BaseModel], loc: tuple[Any, ...]):
7171
for error in error_content:
7272
loc = tuple(error.get("loc", ()))
7373
documentation_url = resolve_model_for_error(cls, loc)
74-
original_line = f" For further information visit {error["url"]}"
74+
original_line = f" For further information visit {error['url']}"
7575
replacement_line = f" For further information visit {documentation_url}"
7676
message = message.replace(original_line, replacement_line, 1)
7777

@@ -161,12 +161,12 @@ class Model(ConfigBaseModel):
161161
# dependencies ---------------------------------------------------------------------------------------------------------------------------------------
162162

163163

164-
class ParserType(str, Enum):
164+
class ParserType(StrEnum):
165165
ALBERT = "albert"
166166
MARKER = "marker"
167167

168168

169-
class DependencyType(str, Enum):
169+
class DependencyType(StrEnum):
170170
ALBERT = "albert"
171171
CELERY = "celery"
172172
ELASTICSEARCH = "elasticsearch"
@@ -297,12 +297,12 @@ def validate_dependencies(self):
297297
The parser dependency can be Albert or Marker, it is converted into a single attribute called "parser".
298298
"""
299299

300-
def create_attribute(name: str, type: Enum, values: Any):
300+
def create_attribute(name: str, type: StrEnum, values: Any):
301301
candidates = [item for item in type if getattr(values, item.value) is not None]
302302

303303
# Ensure only one dependency of this family is defined
304304
if len(candidates) > 1:
305-
raise ValueError(f"Only one {type.__name__} is allowed (provided: {", ".join(c.value for c in candidates)}).")
305+
raise ValueError(f"Only one {type.__name__} is allowed (provided: {', '.join(c.value for c in candidates)}).")
306306

307307
# If no dependency is provided, set the attribute to None
308308
if len(candidates) == 0:
@@ -330,13 +330,13 @@ def create_attribute(name: str, type: Enum, values: Any):
330330

331331

332332
# settings -------------------------------------------------------------------------------------------------------------------------------------------
333-
class LimitingStrategy(str, Enum):
333+
class LimitingStrategy(StrEnum):
334334
MOVING_WINDOW = "moving_window"
335335
FIXED_WINDOW = "fixed_window"
336336
SLIDING_WINDOW = "sliding_window"
337337

338338

339-
class Tokenizer(str, Enum):
339+
class Tokenizer(StrEnum):
340340
TIKTOKEN_GPT2 = "tiktoken_gpt2"
341341
TIKTOKEN_R50K_BASE = "tiktoken_r50k_base"
342342
TIKTOKEN_P50K_BASE = "tiktoken_p50k_base"
@@ -431,7 +431,7 @@ class ConfigFile(ConfigBaseModel):
431431
- `settings`: to configure the API.
432432
433433
:::warnings
434-
We don't recommend to use the configuration file to declare models, prefer to use the API to declare models, by endpoints or on the Playground UI (see [Models configuration](../models/models_configuration.md)).
434+
We don't recommend to use the configuration file to declare models, prefer to use the API to declare models, by endpoints or on the Playground UI (see [Models configuration](/getting-started/models/)).
435435
:::
436436
"""
437437

compose.example.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: opengatellm
22

33
services:
44
api:
5-
image: ghcr.io/etalab-ia/opengatellm/api:latest
5+
image: ghcr.io/etalab-ia/opengatellm/api:0.4.1
66
restart: always
77
env_file: "${APP_ENV_FILE:-./.env}"
88
environment:
@@ -18,7 +18,7 @@ services:
1818
condition: service_healthy
1919

2020
playground:
21-
image: ghcr.io/etalab-ia/opengatellm/playground:latest
21+
image: ghcr.io/etalab-ia/opengatellm/playground:0.4.1
2222
environment:
2323
- "OPENGATELLM_URL=${OPENGATELLM_URL:-http://api:8000}"
2424
- "REDIS_HOST=redis"

docs/astro.config.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ export default defineConfig({
5757
categoryId: 'DIC_kwDOMT6C-84CkkTP'
5858
}),
5959
starlightScrollToTop(),
60-
starlightLinksValidator(),
60+
starlightLinksValidator(
61+
{
62+
errorOnLocalLinks: false,
63+
// `/reference/` is generated from `redoc-static.html` via a custom Astro route.
64+
// Exclude it from link validation because this plugin cannot resolve that custom page.
65+
exclude: ['/reference', '/reference/'],
66+
},
67+
),
6168
],
6269
sidebar: [
6370
{

docs/openapi.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

docs/redoc-static.html

Lines changed: 186 additions & 164 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)