Skip to content

Merge pull request #149 from hugtalbot/202408_latex_in_mkdoc_2 #34

Merge pull request #149 from hugtalbot/202408_latex_in_mkdoc_2

Merge pull request #149 from hugtalbot/202408_latex_in_mkdoc_2 #34

Workflow file for this run

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