Deploy documentation #85
This file contains hidden or 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
| # SPDX-FileCopyrightText: 2026 Arcangelo Massari <arcangelo.massari@unibo.it> | |
| # | |
| # SPDX-License-Identifier: ISC | |
| name: Deploy documentation | |
| on: | |
| workflow_run: | |
| workflows: ["Run tests"] | |
| types: | |
| - completed | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| actions: read | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| working-directory: ./docs | |
| run: npm ci | |
| - name: Find latest successful test run | |
| id: find-run | |
| run: | | |
| RUN_ID=$(gh run list --workflow "Run tests" --branch master --status success --limit 1 --json databaseId --jq '.[0].databaseId') | |
| echo "run-id=$RUN_ID" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Download coverage report | |
| if: steps.find-run.outputs.run-id != '' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: coverage-report | |
| path: docs/public/coverage | |
| run-id: ${{ steps.find-run.outputs.run-id }} | |
| github-token: ${{ github.token }} | |
| continue-on-error: true | |
| - name: Download coverage badge | |
| if: steps.find-run.outputs.run-id != '' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: coverage-badge | |
| path: docs/public/coverage | |
| run-id: ${{ steps.find-run.outputs.run-id }} | |
| github-token: ${{ github.token }} | |
| continue-on-error: true | |
| - name: Build | |
| working-directory: ./docs | |
| run: npm run build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: ./docs/dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |