diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 000000000..335009c5b --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,108 @@ +name: Documentation + +on: + push: + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + + +# 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-main-documentation: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r docs/requirements.txt + + - name: Build documentation + run: | + cd docs/ + make html + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: main-documentation + path: docs/_build/html + + build-package-documentation: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + + - name: Pull latest Docker images + run: | + ./src/docker/pull.sh + + - uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: true + + - name: Build itk-wasm + run: | + pnpm build + + consolidate-documentation: + needs: build-main-documentation + runs-on: ubuntu-22.04 + + steps: + - name: Download main documentation + uses: actions/download-artifact@v4 + with: + name: main-documentation + path: docs + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs + + deploy-gh-pages: + needs: consolidate-documentation + runs-on: ubuntu-22.04 + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + contents: read + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + # with: + # preview: true <-> currently not available to the public