Check if update script works #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish-doc | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'docs-on-gh-pages' | |
tags: | |
- v*-* | |
workflow_dispatch: | |
concurrency: | |
group: pages | |
cancel-in-progress: true | |
jobs: | |
build-doc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/configure-pages@v4 | |
- uses: cvmfs-contrib/github-action-cvmfs@v3 | |
- uses: aidasoft/run-lcg-view@v4 | |
with: | |
container: el9 | |
view-path: /cvmfs/sw-nightlies.hsf.org/key4hep | |
run: | | |
echo "::group::Install dependencies" | |
python3 -m pip install -r doc/requirements.txt | |
export PATH=/root/.local/bin:$PATH | |
echo -e "::endgroup::\n::group::Build podio" | |
cmake -B build . --install-prefix=$(pwd)/install \ | |
-GNinja -DENABLE_SIO=ON -DENABLE_RNTUPLE=ON \ | |
-DBUILD_TESTING=OFF \ | |
-DCMAKE_CXX_STANDARD=17 | |
cmake --build build --target install | |
export PYTHONPATH=$(pwd)/install/python:$PYTHONPATH | |
export LD_LIBRARY_PATH=$(pwd)/install/lib*/:$LD_LIBRARY_PATH | |
export ROOT_INCLUDE_PATH=$(pwd)/install/include | |
echo -e "::endgroup::\n::group::build doc" | |
export GIT_CURRENT_REF=${{ github.ref_name }} | |
sphinx-build -M html doc doc_output | |
# Copy the update_versions script to the artifact so that we have it | |
# available in the second part | |
cp doc/scripts/update_versions.py doc_output/html | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: doc_output/html | |
publish-doc: | |
needs: build-doc | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- uses: actions/download-artifact@v4 | |
with: | |
name: github-pages | |
path: doc_artifact | |
- name: Update documentation | |
env: | |
TARGET_DIR: ${{ github.ref_name }} | |
run: | | |
mkdir -p ${TARGET_DIR} | |
rm -rf ${TARGET_DIR}/* | |
tar -xvf doc_artifact/artifact.tar --directory ${TARGET_DIR} | |
cp ${TARGET_DIR}/update_versions.py . | |
rm -r doc_artifact | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Update version information | |
run: | | |
for dir in */; | |
do python update_versions.py ${dir}/index.html; | |
done | |
rm -r update_versions.py | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.email ${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com | |
git config --global user.name ${GITHUB_ACTOR} | |
git add . | |
git diff-index --quiet HEAD 2>&1 > /dev/null || git commit -m "Update documentation for ${TARGET_DIR}" && git push |