Merge pull request #31 from negz/i-love-you-godoc
Generate and publish API docs to GitHub pages
This commit is contained in:
commit
7ec501d193
|
@ -12,6 +12,19 @@ on:
|
||||||
description: PyPI project version (e.g. v0.1.0)
|
description: PyPI project version (e.g. v0.1.0)
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages.
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Allow only one concurrent deployment, skipping runs queued between the run
|
||||||
|
# in-progress and latest queued. However, do NOT cancel in-progress runs as we
|
||||||
|
# want to allow these production deployments to complete.
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Common versions
|
# Common versions
|
||||||
PYTHON_VERSION: '3.11.5'
|
PYTHON_VERSION: '3.11.5'
|
||||||
|
@ -113,3 +126,36 @@ jobs:
|
||||||
# be enabled, which makes sharing the account hard. We're waiting for
|
# be enabled, which makes sharing the account hard. We're waiting for
|
||||||
# a crossplane org to be approved.
|
# a crossplane org to be approved.
|
||||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
docs:
|
||||||
|
# The simple docs tool we're using doesn't support versions, so our docs
|
||||||
|
# will only reflect what's in main.
|
||||||
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
|
- name: Setup Hatch
|
||||||
|
run: pipx install hatch==1.7.0
|
||||||
|
|
||||||
|
- name: Build Documentation
|
||||||
|
run: hatch run docs:pdoc -d google crossplane/function -o docs
|
||||||
|
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v4
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
path: docs
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
|
@ -158,3 +158,6 @@ cython_debug/
|
||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
# We don't commit our docs - instead we generate them and upload to GitHub pages.
|
||||||
|
docs
|
||||||
|
|
|
@ -16,11 +16,7 @@ classifiers = [
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies = [
|
dependencies = ["grpcio==1.*", "grpcio-reflection==1.*", "structlog==23.*"]
|
||||||
"grpcio==1.*",
|
|
||||||
"grpcio-reflection==1.*",
|
|
||||||
"structlog==23.*",
|
|
||||||
]
|
|
||||||
|
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
|
|
||||||
|
@ -31,7 +27,7 @@ Source = "https://github.com/crossplane/function-sdk-python"
|
||||||
|
|
||||||
[tool.hatch.version]
|
[tool.hatch.version]
|
||||||
path = "crossplane/function/__version__.py"
|
path = "crossplane/function/__version__.py"
|
||||||
validate-bump = false # Allow going from 0.0.0.dev0+x to 0.0.0.dev0+y.
|
validate-bump = false # Allow going from 0.0.0.dev0+x to 0.0.0.dev0+y.
|
||||||
|
|
||||||
[tool.hatch.envs.default]
|
[tool.hatch.envs.default]
|
||||||
type = "virtual"
|
type = "virtual"
|
||||||
|
@ -63,6 +59,14 @@ path = ".venv-test"
|
||||||
[tool.hatch.envs.test.scripts]
|
[tool.hatch.envs.test.scripts]
|
||||||
unit = "python -m unittest tests/*.py"
|
unit = "python -m unittest tests/*.py"
|
||||||
|
|
||||||
|
[tool.hatch.envs.docs]
|
||||||
|
type = "virtual"
|
||||||
|
path = ".venv-docs"
|
||||||
|
dependencies = ["pdoc"]
|
||||||
|
|
||||||
|
[tool.hatch.envs.docs.scripts]
|
||||||
|
generate = "pdoc -m google crossplane/function -o docs"
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
packages = ["crossplane"]
|
packages = ["crossplane"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue