Skip to content

Chore/front cleaning (#946) #17

Chore/front cleaning (#946)

Chore/front cleaning (#946) #17

Workflow file for this run

# Deploys docs to GitHub Pages with versioning.
# Configure GitHub Pages: Settings > Pages > Source = "Deploy from a branch" > Branch = gh-pages
# Docs deploy to gh-pages with versioning. Set Pages: Settings > Pages > Source = gh-pages branch.
name: Deploy documentation
on:
push:
branches: [master]
paths:
- "docs/**"
- "mkdocs.yml"
- "scripts/deploy-docs.sh"
- "codecarbon/_version.py"
- "pyproject.toml"
release:
types: [published]
permissions:
contents: read
concurrency:
group: deploy-docs
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # push to gh-pages
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync --group doc
- name: Get version
id: version
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
else
VERSION=$(uv run python -c "from codecarbon._version import __version__; print(__version__)")
fi
echo "full=$VERSION" >> $GITHUB_OUTPUT
- name: Build docs
run: uv run zensical build -f mkdocs.yml --clean
- name: Deploy to GitHub Pages
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x scripts/deploy-docs.sh
scripts/deploy-docs.sh "${{ steps.version.outputs.full }}"