Skip to content

Commit

Permalink
Use official actions to publish the API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Jul 28, 2024
1 parent 95769c5 commit e95553a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
29 changes: 29 additions & 0 deletions .github/actions/publish-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish API docs

outputs:
docs_url:
description: "Deployed URL"
value: ${{ steps.deployment.outputs.page_url }}/docs/

runs:
using: "composite"

steps:

- name: Prepare GitHub Pages
run: |
mkdir website
cat >website/index.html <<!
<DOCTYPE html>
<meta http-equiv="refresh" content="0;URL=./docs/">
<a href="./docs/">Click here if not redirected</a>
!
mv apidocs website/docs
shell: bash

- uses: actions/upload-pages-artifact@v3
with:
path: website

- uses: actions/deploy-pages@v4
id: deployment
18 changes: 3 additions & 15 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:

permissions:
contents: read
pages: write


defaults:
Expand Down Expand Up @@ -82,22 +83,9 @@ jobs:
# GitHub Actions VM have 2 CPUs.
tox --parallel 2 --installpkg dist/*.whl
- name: Prepare GitHub Pages
- name: Publish API docs
if: contains(matrix['tox-env'], 'apidocs')
run: |
mkdir website
touch website/index.html
mv apidocs website/docs
- name: Publish documentation for push on trunk
# Since we don't have a separate job for apidocs gh-pages updating
# hijack the normal apidoc test and publish the resulting files.
if: contains(matrix['tox-env'], 'apidocs') && github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: Publish docs for ${{ github.sha }}
publish_dir: ./website
uses: ./.github/actions/publish-docs

- name: Prepare coverage results
if: ${{ !cancelled() && !matrix.skip-coverage }}
Expand Down

0 comments on commit e95553a

Please sign in to comment.