Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

ci: untrack .github from gitignore and add pypi-release/docs workflows

Bingxi Zhao (Frank)c4b96e74e5a3
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 000000000..3c46c140d
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,55 @@
+name: Deploy Docs
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - "docs/**"
+ - ".github/workflows/docs.yml"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+concurrency:
+ group: pages
+ cancel-in-progress: false
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 20
+
+ - name: Install dependencies
+ working-directory: docs
+ run: npm install
+
+ - name: Build VitePress site
+ working-directory: docs
+ run: npm run docs:build
+
+ - uses: actions/configure-pages@v5
+
+ - uses: actions/upload-pages-artifact@v3
+ with:
+ path: docs/.vitepress/dist
+
+ deploy:
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ needs: build
+ runs-on: ubuntu-latest
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml
new file mode 100644
index 000000000..5394bcfa0
--- /dev/null
+++ b/.github/workflows/pypi-release.yml
@@ -0,0 +1,154 @@
+name: PyPI Release
+
+# Triggered when a GitHub Release is published.
+# Publishes the full app package with the version derived from the release tag:
+# - deeptutor (Python backend/CLI + packaged Next.js standalone assets)
+#
+# The CLI-only package is intentionally not published to PyPI; install it from
+# a local checkout with `python -m pip install -e ./packaging/deeptutor-cli`.
+#
+# Expected tag format: vMAJOR.MINOR.PATCH, with PEP 440-compatible suffixes allowed.
+# Example: GitHub release tag v1.3.10 -> PyPI version 1.3.10.
+#
+# PyPI authentication uses Trusted Publishing. Configure the `deeptutor` PyPI
+# project to trust this workflow file, then no API token secret is needed.
+
+on:
+ release:
+ types: [published]
+
+permissions:
+ contents: read
+ id-token: write
+
+concurrency:
+ group: pypi-release-${{ github.event.release.tag_name }}
+ cancel-in-progress: false
+
+jobs:
+ build-and-publish:
+ name: Build and Publish PyPI Package
+ runs-on: ubuntu-latest
+ environment:
+ name: pypi
+ url: https://pypi.org/project/deeptutor/
+
+ steps:
+ - name: Checkout release tag
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.release.tag_name }}
+ fetch-depth: 0
+
+ - name: Verify release tag is on main
+ shell: bash
+ run: |
+ set -euo pipefail
+ git fetch origin main:refs/remotes/origin/main --no-tags
+ tag="${{ github.event.release.tag_name }}"
+ tag_commit="$(git rev-list -n 1 "$tag")"
+ if ! git merge-base --is-ancestor "$tag_commit" origin/main; then
+ echo "Release tag $tag ($tag_commit) is not on origin/main; refusing to publish to PyPI." >&2
+ exit 1
+ fi
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.11"
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "22"
+ cache: npm
+ cache-dependency-path: web/package-lock.json
+
+ - name: Install build tools
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install --upgrade build packaging twine
+
+ - name: Verify release tag matches deeptutor/__version__.py
+ id: version
+ shell: bash
+ run: |
+ set -euo pipefail
+ python - <<'PY'
+ import os
+ import re
+ from pathlib import Path
+ from packaging.version import Version
+
+ tag = os.environ["RELEASE_TAG"]
+ tag_raw = tag[1:] if tag.startswith("v") else tag
+ tag_version = str(Version(tag_raw))
+
+ src = Path("deeptutor/__version__.py").read_text(encoding="utf-8")
+ match = re.search(r'^__version__\s*=\s*"([^"]+)"', src, re.MULTILINE)
+ if not match:
+ raise SystemExit(
+ "Could not find __version__ in deeptutor/__version__.py"
+ )
+ code_version = str(Version(match.group(1)))
+
+ if code_version != tag_version:
+ raise SystemExit(
+ f"Release tag {tag!r} (normalized {tag_version!r}) does not "
+ f"match deeptutor/__version__.py value {code_version!r}. "
+ "Bump __version__ before tagging."
+ )
+
+ with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as handle:
+ handle.write(f"version={code_version}\n")
+ PY
+ env:
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
+
+ - name: Install frontend dependencies
+ working-directory: web
+ run: npm ci --legacy-peer-deps
+
+ - name: Build packaged Web assets
+ run: python scripts/prepare_web_package.py
+ env:
+ NEXT_PUBLIC_API_BASE: __NEXT_PUBLIC_API_BASE_PLACEHOLDER__
+ NEXT_PUBLIC_AUTH_ENABLED: __NEXT_PUBLIC_AUTH_ENABLED_PLACEHOLDER__
+
+ - name: Build distributions
+ shell: bash
+ run: |
+ set -euo pipefail
+ mkdir -p dist/deeptutor
+ # Run from /tmp so any repository-local build/ directory cannot shadow
+ # PyPA's `build` module during repeated package builds.
+ # Wheels are the supported public install artifacts. The full app
+ # wheel contains packaged Next.js assets; source distributions would
+ # either duplicate those large assets or require a frontend build.
+ (cd /tmp && python -m build --wheel --outdir "$GITHUB_WORKSPACE/dist/deeptutor" "$GITHUB_WORKSPACE")
+
+ - name: Verify package metadata
+ run: |
+ python -m twine check dist/deeptutor/*
+ python - <<'PY'
+ from pathlib import Path
+ expected = "${{ steps.version.outputs.version }}"
+ files = {
+ "deeptutor": sorted(path.name for path in Path("dist/deeptutor").glob("*")),
+ }
+ for package, names in files.items():
+ print(package)
+ print("\n".join(f" {name}" for name in names))
+ required = [
+ ("deeptutor", f"deeptutor-{expected}-py3-none-any.whl"),
+ ]
+ missing = [name for package, name in required if name not in files[package]]
+ if missing:
+ raise SystemExit(f"Missing expected distributions: {missing}")
+ PY
+
+ - name: Publish deeptutor to PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ packages-dir: dist/deeptutor/
+ print-hash: true
diff --git a/.gitignore b/.gitignore
index 2e36dfa0c..215ac085b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@ run_code_workspace/
deeptutor/agents/question/reference_papers/
deeptutor/services/rag/eg_only_for_analysis/
docs/
-.github
.claude
# LaTeX build artifacts