-
Notifications
You must be signed in to change notification settings - Fork 37
100 lines (83 loc) · 3.13 KB
/
doc.yml
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
name: DocGenerateAndPublish
on:
workflow_dispatch:
push:
branches:
- gen
- master
schedule:
- cron: '0 0 * * *' # every day at midnight
permissions:
id-token: write
pages: write
jobs:
build:
name: Run on ${{ matrix.os }} with SOFA ${{ matrix.sofa_branch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
sofa_branch: [master]
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Setup SOFA and environment
id: sofa
uses: sofa-framework/sofa-setup-action@v5
with:
sofa_root: ${{ github.workspace }}/sofa
sofa_version: ${{ matrix.sofa_branch }}
sofa_scope: 'full'
sofa_with_sofapython3: 'true'
- name: Checkout source code
uses: actions/checkout@v4
with:
path: 'SofaDocGenerator'
- name: Checkout merged doc branch
uses: actions/checkout@v4
with:
path: 'merged_doc'
ref: 'merged_doc'
- name: Generate doc
run: |
echo $SOFA_ROOT
export PYTHONPATH=$SOFA_ROOT/plugins/SofaPython3/lib/python3/site-packages:$PYTHONPATH
echo $PYTHONPATH
pip install gitpython
pip install requests
python ${{ github.workspace }}/SofaDocGenerator/script/pipeline.py ${{ github.workspace }}/SofaDocGenerator/doc ${{ github.workspace }}/sofa/share/sofa/examples ${{ github.workspace }}/sofa/plugins
python ${{ github.workspace }}/SofaDocGenerator/script/title_metadata.py ${{ github.workspace }}/SofaDocGenerator/doc
python ${{ github.workspace }}/SofaDocGenerator/script/generate_nav.py ${{ github.workspace }}/SofaDocGenerator/mkdocs/mkdocs.yml ${{ github.workspace }}/SofaDocGenerator/doc
- name: Save merged doc
uses: actions/upload-artifact@v4
with:
name: doc_merged_markdown
path: ${{ github.workspace }}/SofaDocGenerator/doc
overwrite: true
if-no-files-found: error
- name: Commit merged doc
continue-on-error: true
run: |
cd ${{ github.workspace }}/merged_doc
rm -rf *
cp -a --verbose ${{ github.workspace }}/SofaDocGenerator/doc/* ${{ github.workspace }}/merged_doc
git config --global user.name "doc generator"
git config --global user.email "[email protected]"
git status
git add *
git status
git commit -a -m "Update documentation"
git push --force
- name: Install dependencies
run: pip install mkdocs mkdocs-material
- name: Copy files for mkdocs
run: |
mkdir -p ${{ github.workspace }}/SofaDocGenerator/mkdocs/docs
cp -a ${{ github.workspace }}/merged_doc/* ${{ github.workspace }}/SofaDocGenerator/mkdocs/docs
- name: Mkdocs build and deploy
run: |
cd ${{ github.workspace }}/SofaDocGenerator/mkdocs
mkdocs gh-deploy --force