Fix GitHub Pages deployment, update remaining references to old repo and TravisCI, add more pre-commit hooks #33
Workflow file for this run
This file contains 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
name: build | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
name: Build and Test Package | |
strategy: | |
matrix: | |
version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.version }} | |
- name: Install package | |
run: pip install . | |
- name: Run tests | |
run: python -m unittest discover -v | |
- name: Build documentation | |
run: |- | |
mkdir html | |
git fetch --all | |
python -I -m sphinx_multiversion -W docs html | |
cp assets/gh-pages-redirect.html html/index.html | |
- name: Upload the Docs | |
uses: actions/upload-pages-artifact@v3 | |
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.12' | |
with: | |
name: docs | |
path: html/ | |
- name: Install pypa/build | |
run: pip install build | |
- name: Build a binary wheel and a source tarball | |
run: python3 -m build | |
- name: Store the distribution packages | |
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.12' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
deploy-docs: | |
name: Deploy Docs to GitHub Pages | |
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
needs: [build] | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action | |
with: | |
artifact_name: docs | |
deploy-testpypi: | |
name: Deploy Distribution to Test PyPI | |
if: false # Currently disabled | |
needs: [build] | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/sphinx-multiversion | |
permissions: | |
id-token: write | |
steps: | |
- name: Download the Distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish Distributions to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
deploy-pypi: | |
name: Deploy Distribution to PyPI | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/sphinx-multiversion | |
permissions: | |
id-token: write | |
steps: | |
- name: Download the Distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish Distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |