-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (73 loc) · 2.16 KB
/
docs.yml
File metadata and controls
89 lines (73 loc) · 2.16 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Docs
on:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
name: Deploy Documentation
if: github.repository == 'dnv-opensource/solarfarmer-python-sdk'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
with:
enablement: true
- name: Set up Python with uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.11"
- name: Set cache key
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
with:
key: uv-solarfarmer-${{ env.cache_id }}
path: ~/.cache/uv
restore-keys: |
uv-solarfarmer-
- name: Install documentation dependencies
run: uv sync --extra docs
- name: Determine version from git
id: version
run: |
# Use tag version if on a tagged commit, otherwise use dev
if git describe --tags --exact-match 2>/dev/null; then
VERSION=$(git describe --tags --exact-match | sed 's/^v//')
else
VERSION="dev"
fi
echo "DOCS_VERSION=$VERSION" >> $GITHUB_ENV
echo "Building documentation with version: $VERSION"
- name: Build documentation
run: uv run zensical build --clean
- name: Validate build output
run: |
if [ ! -d "site" ]; then
echo "Error: site/ directory not found"
exit 1
fi
if [ -z "$(ls -A site)" ]; then
echo "Error: site/ directory is empty"
exit 1
fi
echo "Build validation successful"
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4