Skip to content

Commit

Permalink
Job to publish documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kretep committed Jul 4, 2024
1 parent 8eb0444 commit 01c4ac5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
python-version: ${{ matrix.python-version }}

# Get the version from pyproject.toml
# This will be used to tag the release in the publishing workflow
- name: Install toml package
run: pip install toml
- name: Get version from pyproject.toml
Expand All @@ -43,22 +44,38 @@ jobs:
echo Version: $VERSION
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Installation
- name: Install dependencies
run: |
python -m pip install poetry
poetry install
- name: Build the docs # just to see whether the build passes
run: |
poetry run make html --directory docs
# Testing and checking
- name: Test with pytest
run: |
poetry run pytest
# TODO: run pytype here?
- name: Type check
run: |
poetry run pytype .
# Build the package
- name: Build the package
run: |
poetry build
- name: Archive build artifacts
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/release'
with:
name: build-artifacts
path: dist/

# Build the docs
- name: Build the docs
run: |
poetry run make html --directory docs
- name: Archive documentation
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/release'
with:
name: docs-html
path: docs/_build/html/
21 changes: 20 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#workflow-definition
# https://github.com/marketplace/actions/pypi-publish

name: Publish to PyPI
name: Publish package and docs

on:
push:
Expand Down Expand Up @@ -94,3 +94,22 @@ jobs:
gh release upload
"v${VERSION}" dist/**
--repo '${{ github.repository }}'
publish-docs:
name: Publish documentation
needs: build-and-test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download the documentation
uses: actions/download-artifact@v4
with:
name: docs-html
path: docs/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/

0 comments on commit 01c4ac5

Please sign in to comment.