Debian Codegraph @

.github/workflows/generate-docs.yml

raw
1 name: Generate Documentation
2
3 on:
4 pull_request:
5 branches: [amd-staging, amd-mainline, release/rocm-rel-*]
6 push:
7 branches: [amd-staging, amd-mainline, release/rocm-rel-*]
8 workflow_dispatch:
9
10 permissions:
11 contents: read
12
13 env:
14 DEBIAN_FRONTEND: noninteractive
15 DEBCONF_NONINTERACTIVE_SEEN: true
16 BUILD_TYPE: Release
17
18 jobs:
19 generate-docs:
20 name: Generate Documentation
21 runs-on: AMD-ROCm-Internal-dev1
22 steps:
23 - name: Checkout Repository
24 uses: actions/checkout@v4
25
26 - name: Get branch name for artifact naming
27 id: get_branch_info
28 run: |
29 BRANCH_NAME=""
30 if [[ "${{ github.event_name }}" == "pull_request" ]]; then
31 BRANCH_NAME="${{ github.head_ref }}"
32 else
33 BRANCH_NAME="${{ github.ref_name }}"
34 fi
35 SANITIZED_NAME=$(echo "$BRANCH_NAME" | sed -e 's|/|-|g' -e 's|[^a-zA-Z0-9._-]||g' -e 's|^-*||' -e 's|-*$||')
36 if [[ -z "$SANITIZED_NAME" ]]; then
37 SANITIZED_NAME="docs-$(date +%s)"
38 fi
39 echo "sanitized_name=${SANITIZED_NAME}" >> $GITHUB_OUTPUT
40
41 - name: Set up Python
42 uses: actions/setup-python@v4
43 with:
44 python-version: '3.12'
45
46 - name: Install System Dependencies
47 run: |
48 sudo apt-get update
49 sudo apt-get install -y doxygen graphviz
50
51 - name: Set Up Python Environment
52 run: |
53 python3 -m pip install --upgrade pip
54 python3 -m pip install -r docs/sphinx/requirements.txt
55
56 - name: Build Documentation
57 run: |
58 if [ ! -e "docs/.git" ]; then
59 if [ -d ".git" ]; then
60 ln -s ../.git docs/.git
61 fi
62 fi
63 cd docs
64 python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
65
66 - name: Upload Documentation
67 uses: actions/upload-artifact@v4
68 with:
69 name: documentation-${{ steps.get_branch_info.outputs.sanitized_name }}
70 path: docs/_build/html/
71
72 - name: Generate Job Summary
73 run: |
74 cat >> $GITHUB_STEP_SUMMARY << 'EOF'
75 # 📚 Documentation Generated Successfully!
76
77 ## 🚀 Quick Start
78
79 1. **📥 Download** the artifact `documentation-${{ steps.get_branch_info.outputs.sanitized_name }}`
80 2. **📂 Extract** the ZIP file
81 3. **🖱️ Double-click** `index.html`
82 4. **✅ Done!** Documentation opens with full formatting in your browser
83 EOF