init repo #18
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: CD | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
release: | |
types: | |
- published | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: 3 | |
jobs: | |
dist: | |
name: Distribution build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: hynek/build-and-inspect-python-package@v2 | |
publish-pypi: | |
needs: [dist] | |
name: Publish to PyPI | |
environment: | |
name: pypi | |
url: https://pypi.org/p/${{ github.event.repository.name }} | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Download packages built by build-and-inspect-python-package | |
with: | |
name: Packages | |
path: dist | |
uses: actions/download-artifact@v4 | |
- name: Upload package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: | |
github.event_name == 'release' && github.event.action == 'published' | |
&& env.PYPI_API_TOKEN != null | |
env: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
pages: | |
name: Deploy to GitHub Pages | |
runs-on: ubuntu-latest | |
if: | |
${{ github.ref_name == github.event.repository.default_branch || | |
(github.event_name == 'release' && github.event.action == 'published') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.head_ref }} | |
- uses: wntrblm/[email protected] | |
with: | |
python-versions: "3.11" | |
- name: Verify no changes required to API docs | |
run: | | |
nox -s build_api_docs | |
git diff --exit-code | |
- name: Generate docs | |
run: nox -s docs | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_build/html |