Merge pull request #4 from sachs7/sachs7-patch-1 #1
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: Generate and Deploy Docs | |
# Trigger the workflow on push events to the main branch | |
on: | |
push: | |
branches: | |
- main # Trigger when changes are merged into the main branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the code | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' # Specify your Python version | |
# Step 3: Install dependencies (pdoc) | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pdoc3 | |
# Step 4: Generate documentation using pdoc | |
- name: Generate Documentation | |
run: | | |
pdoc3 --html --output-dir docs . | |
# Step 5: Deploy to GitHub Pages (gh-pages branch) | |
- name: Deploy to GitHub Pages | |
run: | | |
# Configure Git | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
# Create a new Git repo inside the docs/ folder | |
cd docs | |
git init | |
git checkout -b gh-pages | |
# Add the generated documentation to the repository | |
git add . | |
git commit -m "Update documentation after merge to main" | |
# Force-push to the gh-pages branch | |
git push --force "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages:gh-pages |