-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (64 loc) · 3.34 KB
/
api-docs.yaml
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
name: api-docs
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
if: |
github.repository != 'CogStack/CogStack-ModelServe' &&
github.ref == 'refs/heads/master' &&
github.event_name == 'push'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9 ]
max-parallel: 1
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r app/requirements.txt -r app/requirements-dev.txt
- name: Check the CLI doc
run: |
typer app/cli/cli.py utils docs --output cli.md
if ! cmp -s cli.md app/cli/README.md; then
echo "The CMS CLI README needs updating"
exit 1
fi
- name: Generate API docs
run: |
python app/cli/cli.py export-model-apis --model-type medcat_snomed --add-training-apis --no-exclude-unsupervised-training --no-exclude-metacat-training --add-evaluation-apis --add-previews-apis
python app/cli/cli.py export-model-apis --model-type medcat_icd10 --add-training-apis --no-exclude-unsupervised-training --no-exclude-metacat-training --add-evaluation-apis --add-previews-apis
python app/cli/cli.py export-model-apis --model-type medcat_umls --add-training-apis --no-exclude-unsupervised-training --no-exclude-metacat-training --add-evaluation-apis --add-previews-apis
python app/cli/cli.py export-model-apis --model-type medcat_deid --add-training-apis --add-evaluation-apis --add-previews-apis --exclude-metacat-training --exclude-unsupervised-training
python app/cli/cli.py export-model-apis --model-type transformers_deid --add-training-apis --add-evaluation-apis --add-previews-apis --exclude-metacat-training --exclude-unsupervised-training
python app/cli/cli.py export-openapi-spec
git fetch origin gh-pages:gh-pages
git checkout gh-pages
mv ./medcat_snomed_model_apis.json ./docs/medcat_snomed_model_apis.json
mv ./medcat_icd10_model_apis.json ./docs/medcat_icd10_model_apis.json
mv ./medcat_umls_model_apis.json ./docs/medcat_umls_model_apis.json
mv ./medcat_deid_model_apis.json ./docs/medcat_deid_model_apis.json
mv ./transformers_deid_model_apis.json ./docs/transformers_deid_model_apis.json
mv ./cogstack_model_serve_apis.json ./docs/cogstack_model_serve_apis.json
git config --global user.name "Xi Bai"
git config --global user.email "[email protected]"
git add ./docs/medcat_snomed_model_apis.json ./docs/medcat_icd10_model_apis.json ./docs/medcat_umls_model_apis.json ./docs/medcat_deid_model_apis.json ./docs/transformers_deid_model_apis.json ./docs/cogstack_model_serve_apis.json
if [[ `git status --porcelain --untracked-files=no` ]]; then
git commit -m "update api docs"
else
echo "No API doc changes detected and publishing skipped."
exit 0
fi
- name: Update API docs
uses: ad-m/github-push-action@master
with:
branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}