diff --git a/.github/workflows/harp.yml b/.github/workflows/harp.yml index 74ad5a5..4c876d0 100644 --- a/.github/workflows/harp.yml +++ b/.github/workflows/harp.yml @@ -8,6 +8,10 @@ on: release: types: [published] workflow_dispatch: + inputs: + publish-docs-website: + description: "Publish docs website to GitHub Pages?" + default: "false" jobs: # ---- Tests ---- @@ -115,12 +119,10 @@ jobs: with: files: dist/* - # ---- Docs ---- + # ---- Build docs ---- build-docs: - name: Build and deploy documentation to GitHub Pages + name: Build documentation runs-on: ubuntu-latest - needs: build-release - if: github.event_name == 'release' && !github.event.release.prerelease steps: - name: Checkout uses: actions/checkout@v7 @@ -135,10 +137,34 @@ jobs: - name: Install dependencies run: uv sync --group docs - - name: Configure Git user - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + - name: Build documentation + run: uv run mkdocs build + + - name: Collect documentation website artifact + uses: actions/upload-pages-artifact@v5 + with: + path: site/ - - name: Build & Deploy docs - run: uv run mkdocs gh-deploy --force + # ---- Publish docs ---- + publish-docs: + name: Publish documentation to GitHub Pages + runs-on: ubuntu-latest + needs: [build-docs, publish-to-pypi] + permissions: + # Both required by actions/deploy-pages. + pages: write + id-token: write + environment: + name: documentation-website + url: ${{ steps.publish.outputs.page_url }} + if: | + !cancelled() && !failure() && needs.build-docs.result == 'success' + && ( + (github.event_name == 'release' && !github.event.release.prerelease) + || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-docs-website == 'true') + || (github.event_name == 'push' && vars.CONTINUOUS_DOCUMENTATION) + ) + steps: + - name: Publish to GitHub Pages + id: publish + uses: actions/deploy-pages@v5