-
Notifications
You must be signed in to change notification settings - Fork 46
92 lines (79 loc) · 2.69 KB
/
docs.yml
File metadata and controls
92 lines (79 loc) · 2.69 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
90
91
92
name: Build and Deploy Documentation
on:
# Build preview documentation for pull requests
pull_request:
# Build and deploy documentation for master branch
push:
branches:
- master
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz
- name: Install Python dependencies
working-directory: docs
run: |
pip install -r requirements.txt
- name: Build documentation
working-directory: docs
run: |
chmod +x build_docs.sh
./build_docs.sh
- name: Upload documentation artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: |
docs/_build
!docs/_build/.doctrees
deploy-docs:
needs: build-docs
runs-on: ubuntu-latest
# Set Deploy environment for master branch, otherwise set Preview environment
environment: ${{ github.ref_name == 'master' && 'esp-docs deploy' || 'esp-docs preview' }}
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
with:
name: docs
path: docs/_build
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Python dependencies
working-directory: docs
run: |
pip install -r requirements.txt
- name: Get git version
id: git_version
run: |
git_ver=$(git describe --always)
echo "version=$git_ver" >> $GITHUB_OUTPUT
echo "GIT_VER=$git_ver" >> $GITHUB_ENV
- name: Deploy documentation
working-directory: docs
shell: bash
env:
GIT_VER: ${{ steps.git_version.outputs.version }}
DOCS_BUILD_DIR: ${{ github.workspace }}/docs/_build
DOCS_DEPLOY_URL_BASE: ${{ vars.DOCS_URL_BASE }}
DOCS_DEPLOY_SERVER: ${{ vars.DOCS_SERVER }}
DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_SERVER_USER }}
DOCS_DEPLOY_PATH: ${{ vars.DOCS_PATH }}
DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_PRIVATEKEY }}
# TYPE is optional - only used for output formatting (shows "deploy" or "preview" in logs)
TYPE: ${{ github.ref_name == 'master' && 'deploy' || 'preview' }}
run: |
source $GITHUB_WORKSPACE/docs/utils.sh
add_doc_server_ssh_keys "$DOCS_DEPLOY_PRIVATEKEY" "$DOCS_DEPLOY_SERVER" "$DOCS_DEPLOY_SERVER_USER"
deploy-docs