Add website CI build with artifacts for pull requests #13
Workflow file for this run
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
# Based on sample workflow for building and deploying a Jekyll site to GitHub Pages | |
name: Build and deploy OFT website using GitHub Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["gh-pages"] | |
pull_request: | |
types: [opened, reopened, synchronize] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install prerequisites | |
run: | | |
sudo apt -y install doxygen graphviz | |
pip3 install jupyter nbconvert | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v4 | |
- name: Create build dir | |
run: mkdir build_docs | |
- name: Configure OFT documentation | |
shell: bash | |
working-directory: build_docs | |
run: cmake -DOFT_BUILD_DOCS:BOOL=ON -DOFT_DOCS_ONLY:BOOL=ON -DOFT_PACKAGE_NIGHTLY:BOOL=OFF ../src | |
- name: Build OFT documentation | |
shell: bash | |
working-directory: build_docs | |
run: make docs | |
- name: Package full site | |
run: | | |
cp -r src/docs/website _site | |
cp -r build_docs/doc/html _site/docs | |
- name: Fix permissions | |
run: | | |
chmod -c -R +rX "_site/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload actions artifact | |
if: github.event_name == 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pull_${{ github.event.pull_request.number }}-website | |
path: _site/ | |
overwrite: true | |
- name: Upload pages artifact | |
if: github.event_name != 'pull_request' | |
uses: actions/upload-pages-artifact@v3 | |
# Deployment job | |
deploy: | |
if: github.event_name != 'pull_request' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |