Deploy Gambit Site #88
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: Deploy Gambit Site | |
on: | |
workflow_dispatch: | |
inputs: | |
rebuild_all: | |
description: 'Rebuild doxygen documentation in addition to deploying site' | |
type: boolean | |
required: true | |
default: false | |
repo_to_document: | |
description: 'Latest GAMBIT release repo' | |
required: true | |
default: 'https://github.com/GambitBSM/gambit_2.4.git' | |
jobs: | |
document_repo: | |
if: ${{ inputs.rebuild_all }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Modified doxybook2 source code is present in the repo, so it must be built (uncomment if this is necessary) | |
#- name: Build doxybook2 | |
# run: cd doxybook2 | |
# && vcpkg install --triplet x64-linux $(cat vcpkg.txt) | |
# && rm -r build | |
# && mkdir build | |
# && cmake -B ./build -G "Unix Makefiles" --debug-find -DCMAKE_PREFIX_PATH=/usr/local/share/vcpkg/packages/inja_x64-linux/ -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_PREFIX_PATH=/usr/local/share/vcpkg/packages/inja_x64-linux/ | |
# && cmake --build ./build --config MinSizeRel | |
- name: Shallow clone repo | |
run: git clone --depth 1 ${{ inputs.repo_to_document }} gambit_source | |
- name: Generate doxygen xml | |
uses: mattnotmitt/doxygen-action@v1.9.4 | |
with: | |
working-directory: ./gambit_source | |
doxyfile-path: ../doxygen_and_doxybook2_config/Doxyfile | |
- name: Clear old documentation | |
run: cd content/en/documentation | |
&& rm -r code | |
&& mkdir code | |
- name: Convert xml to md using doxybook2 | |
run: ./doxybook2/build/src/DoxybookCli/doxybook2 --input ./xml --output ./content/en/documentation/code --config ./doxygen_and_doxybook2_config/config.json --templates ./doxygen_and_doxybook2_config/doxybook_templates | |
# Need to insert index file so that menus work in site | |
- name: Copy index template into repo folder to act as parent menu | |
run: cp code_index_template.md ./content/en/documentation/code/_index.md | |
- name: Remove cloned directory | |
run: rm -r gambit_source | |
- name: Commit changes | |
run: git config --local user.email "test@github.com" | |
&& git config --local user.name "GitHub Action test" | |
&& git add --all | |
&& git commit -m "Documentation rebuild" | |
&& git push | |
# This job downloads the artifacts and then builds/deploys site to github pages | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [document_repo] | |
if: ${{ always() }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Cache npm packages | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
# cache: 'npm' | |
- name: Install npm dependencies and build site | |
run: npm install | |
&& npm run build | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public |