Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Publish documentation to github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
kretep committed Jul 4, 2024
1 parent b05b02a commit cadfc0b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
24 changes: 21 additions & 3 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,21 +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 mkdocs build
# Testing and checking
- name: Test with pytest
run: |
poetry run pytest
- 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 cadfc0b

Please sign in to comment.