-
-
Notifications
You must be signed in to change notification settings - Fork 264
73 lines (60 loc) · 1.94 KB
/
deploy-docs.yml
File metadata and controls
73 lines (60 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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"
- "scripts/check_docs_links.py"
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@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
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: Check documentation links
run: uv run python scripts/check_docs_links.py site
- 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 }}"