Skip to content

Commit bcbc0e4

Browse files
ci: add pdoc3 docs workflow and simplify release-drafter (#12)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent cd6cbf1 commit bcbc0e4

5 files changed

Lines changed: 228 additions & 55 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Generate Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: {}
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
name: Build Docs
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v2
28+
with:
29+
version: "latest"
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.12"
35+
36+
- name: Install dependencies
37+
run: uv sync --group dev
38+
39+
- name: Build documentation
40+
run: uv run poe docs-generate
41+
42+
- name: Get generated docs directory
43+
id: docs-dir
44+
run: echo "path=$(uv run poe -q get-generated-docs-dir)" >> $GITHUB_OUTPUT
45+
46+
- name: Upload docs artifacts
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: docs-${{ github.run_id }}
50+
path: ${{ steps.docs-dir.outputs.path }}
51+
52+
- name: Setup Pages
53+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
54+
uses: actions/configure-pages@v5
55+
56+
- name: Upload Pages artifact
57+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58+
uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: ${{ steps.docs-dir.outputs.path }}
61+
62+
deploy:
63+
name: Publish Docs
64+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
runs-on: ubuntu-latest
69+
needs: build
70+
steps:
71+
- name: Deploy to GitHub Pages
72+
id: deployment
73+
uses: actions/deploy-pages@v4
Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Release Drafter
22

33
on:
4+
workflow_dispatch: {}
45
push:
56
branches:
67
- main
@@ -10,86 +11,47 @@ concurrency:
1011
cancel-in-progress: false
1112

1213
jobs:
13-
update_release_draft:
14-
# Only runs on push to main - creates/updates draft release notes
14+
draft_release:
15+
name: Draft Release
1516
permissions:
1617
contents: write
1718
pull-requests: write
1819
runs-on: ubuntu-latest
1920
steps:
20-
- uses: aaronsteers/semantic-pr-release-drafter@v0.3.0
21+
- name: Create or update draft release
22+
uses: aaronsteers/semantic-pr-release-drafter@v0.3.1
2123
id: release-drafter
2224
env:
2325
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2426

25-
outputs:
26-
upload_url: ${{ steps.release-drafter.outputs.upload_url }}
27-
tag_name: ${{ steps.release-drafter.outputs.tag_name }}
28-
release_id: ${{ steps.release-drafter.outputs.id }}
29-
30-
# Build and upload assets to the draft release (only on push to main)
31-
upload_release_assets:
32-
name: Upload Release Assets
33-
needs: [update_release_draft]
34-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
35-
runs-on: ubuntu-latest
36-
permissions:
37-
contents: write
38-
steps:
39-
- name: Checkout Repo
40-
uses: actions/checkout@v4
41-
with:
42-
fetch-depth: 0
43-
4427
- name: Delete existing release assets
4528
uses: andreaswilli/delete-release-assets-action@v4.0.0
46-
# Delete all existing assets to ensure clean replacement
47-
# This prevents stale artifacts from accumulating, e.g. if artifact names change
4829
with:
4930
github_token: ${{ secrets.GITHUB_TOKEN }}
50-
tag: ${{ needs.update_release_draft.outputs.tag_name }}
31+
tag: ${{ steps.release-drafter.outputs.tag_name }}
5132
deleteOnlyFromDrafts: true
5233

5334
- name: Install uv
5435
uses: astral-sh/setup-uv@v7
5536
with:
5637
version: "latest"
5738

58-
- name: Set up Python
59-
uses: actions/setup-python@v5
39+
- name: Checkout Repo
40+
uses: actions/checkout@v6
6041
with:
61-
python-version: "3.12"
62-
63-
- name: Get version from draft release tag
64-
id: version
65-
run: |
66-
TAG_NAME="${{ needs.update_release_draft.outputs.tag_name }}"
67-
# Remove 'v' prefix if present
68-
VERSION="${TAG_NAME#v}"
69-
echo "version=$VERSION" >> $GITHUB_OUTPUT
70-
echo "Building version: $VERSION"
42+
fetch-depth: 0
7143

7244
- name: Build package
7345
env:
74-
UV_DYNAMIC_VERSIONING_BYPASS: ${{ steps.version.outputs.version }}
75-
run: uv build
76-
77-
- name: Upload wheel to draft release
78-
uses: svenstaro/upload-release-action@v2
79-
with:
80-
repo_token: ${{ secrets.GITHUB_TOKEN }}
81-
file: dist/*.whl
82-
release_id: ${{ needs.update_release_draft.outputs.release_id }}
83-
overwrite: true
84-
file_glob: true
85-
draft: true
46+
TAG_NAME: ${{ steps.release-drafter.outputs.tag_name }}
47+
run: UV_DYNAMIC_VERSIONING_BYPASS="${TAG_NAME#v}" uv build
8648

87-
- name: Upload sdist to draft release
49+
- name: Upload assets to draft release
8850
uses: svenstaro/upload-release-action@v2
8951
with:
9052
repo_token: ${{ secrets.GITHUB_TOKEN }}
91-
file: dist/*.tar.gz
92-
release_id: ${{ needs.update_release_draft.outputs.release_id }}
53+
file: dist/*.{whl,tar.gz}
54+
release_id: ${{ steps.release-drafter.outputs.id }}
9355
overwrite: true
9456
file_glob: true
9557
draft: true

poe_tasks.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ install = "uv sync --extra dev"
2424
install-prod = "uv sync"
2525
build = "uv build"
2626

27-
# Documentation (placeholder for future)
28-
docs = "echo 'Documentation generation not yet configured'"
29-
docs-serve = "echo 'Documentation serving not yet configured'"
27+
# Documentation with pdoc3
28+
docs-generate = "pdoc --html --output-dir docs/generated fastmcp_extensions --force"
29+
docs-preview = { shell = "pdoc --html --output-dir docs/generated fastmcp_extensions --force && open docs/generated/fastmcp_extensions/index.html" }
30+
get-generated-docs-dir = "echo docs/generated/fastmcp_extensions"
3031

3132
# Development helpers
3233
clean = "rm -rf .pytest_cache .coverage htmlcov dist .ruff_cache"

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,9 @@ ignore = ["DEP004"] # Ignore misplaced dev dependencies (common for test framew
9797
[tool.deptry.per_rule_ignores]
9898
# uvicorn is a transitive dependency through fastmcp, used for HTTP server testing
9999
DEP003 = ["uvicorn"]
100+
101+
[dependency-groups]
102+
dev = [
103+
"pdoc3>=0.11.6",
104+
"poethepoet>=0.37.0",
105+
]

0 commit comments

Comments
 (0)