Build and deploy website #169
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: Build and deploy website | |
on: | |
# Only build and deploy the website once the documentation is built (and the test suite is completed => coverage report and badge are necessary) | |
workflow_run: | |
workflows: [Build documentation] | |
types: [completed] | |
branches: [main] | |
# 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_website: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r website/requirements.txt | |
- name: Build Sphinx website | |
run: | | |
sphinx-build -b html website/docs/source website/docs/build | |
- name: Upload website artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: website | |
path: website/docs/build/ | |
deploy: | |
environment: | |
name: Website | |
url: http://imcs-compsim.github.io/meshpy | |
runs-on: ubuntu-latest | |
needs: build_website | |
permissions: | |
pages: write | |
id-token: write | |
contents: read | |
steps: | |
- name: Download website artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: website | |
path: ${{ github.workspace }} | |
- name: Download API documentation artifact | |
uses: dawidd6/action-download-artifact@v8 | |
with: | |
workflow: documentation.yml | |
name: api-documentation | |
path: ${{ github.workspace }}/api-documentation | |
branch: ${{ github.event.repository.default_branch }} | |
- name: Download coverage report artifact | |
uses: dawidd6/action-download-artifact@v8 | |
with: | |
workflow: testing.yml | |
name: coverage-report | |
path: ${{ github.workspace }}/coverage-report | |
branch: ${{ github.event.repository.default_branch }} | |
- name: Download coverage badge artifact | |
uses: dawidd6/action-download-artifact@v8 | |
with: | |
workflow: testing.yml | |
name: coverage-badge | |
path: ${{ github.workspace }}/coverage-badge | |
branch: ${{ github.event.repository.default_branch }} | |
- name: Upload all pages artifacts (website, coverage-report, coverage-badge, documentation) | |
uses: actions/upload-pages-artifact@v3 | |
id: deployment | |
with: | |
path: ${{ github.workspace }} | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |