Skip to content

Commit 21c710c

Browse files
committed
Docs deploy CI updated for production deployment
1 parent b997f4c commit 21c710c

File tree

5 files changed

+66
-149
lines changed

5 files changed

+66
-149
lines changed

.github/workflows/docs.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
name: Build the Docs Legacy ReadTheDocs CI
1+
name: Documentation Build and Deploy CI
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
- release/*
8-
paths:
9-
- 'docs/**'
10-
- '.github/workflows/docs_legacy.yml'
114
pull_request:
125
paths:
136
- 'docs/**'
14-
- '.github/workflows/docs_legacy.yml'
7+
- '.github/workflows/docs.yml'
158

169
jobs:
1710

1811
build-docs:
19-
name: Build ReadTheDocs
12+
name: Build Documentation
2013
runs-on: ubuntu-22.04
2114
defaults:
2215
run:
@@ -34,5 +27,11 @@ jobs:
3427
sudo apt install python3-pip python3-setuptools
3528
# GitHub CI installs pip3 and setuptools outside the path.
3629
# Update the path to include them and run.
37-
PATH=/home/runner/.local/bin:$PATH pip3 install --user -r ./docs/requirements.txt
38-
cd ./docs && PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" make html
30+
cd ./docs
31+
PATH=/home/runner/.local/bin:$PATH pip3 install -r requirements.txt --prefer-binary
32+
PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" build-docs -l en
33+
- name: Archive Docs
34+
uses: actions/upload-artifact@v2
35+
with:
36+
name: docs
37+
path: docs

.github/workflows/docs_deploy.yml

Lines changed: 8 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,17 @@
1-
name: Documentation Build and Deploy CI
1+
name: Documentation Build and Deploy Production CI
22

33
on:
44
push:
55
branches:
6-
- master
76
- release/*
87
paths:
98
- 'docs/**'
109
- '.github/workflows/docs.yml'
11-
pull_request:
12-
paths:
13-
- 'docs/**'
14-
- '.github/workflows/docs.yml'
1510

1611
jobs:
1712

18-
build-docs:
19-
name: Build ESP-Docs
20-
runs-on: ubuntu-22.04
21-
defaults:
22-
run:
23-
shell: bash
24-
steps:
25-
- uses: actions/checkout@v3
26-
with:
27-
submodules: true
28-
- uses: actions/setup-python@v4
29-
with:
30-
python-version: '3.10'
31-
- name: Build
32-
run: |
33-
sudo apt update
34-
sudo apt install python3-pip python3-setuptools
35-
# GitHub CI installs pip3 and setuptools outside the path.
36-
# Update the path to include them and run.
37-
cd ./docs
38-
PATH=/home/runner/.local/bin:$PATH pip3 install -r requirements.txt --prefer-binary
39-
PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" build-docs -l en
40-
- name: Archive Docs
41-
uses: actions/upload-artifact@v2
42-
with:
43-
name: docs
44-
path: docs
45-
46-
deploy-preview-docs:
47-
name: Deploy Documentation
13+
deploy-prod-docs:
14+
name: Deploy Documentation Production
4815
runs-on: ubuntu-22.04
4916
defaults:
5017
run:
@@ -59,20 +26,12 @@ jobs:
5926
- name: Deploy Preview
6027
env:
6128
# Deploy to production server
62-
# DOCS_BUILD_DIR: "./docs/_build/"
63-
# DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_DEPLOY_KEY }}
64-
# DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }}
65-
# DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_SERVER_USER }}
66-
# DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }}
67-
# DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }}
68-
# Deploy to preview server
69-
TYPE: "preview"
7029
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
71-
DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_KEY }}
72-
DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }}
73-
DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }}
74-
DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }}
75-
DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_USER }}
30+
DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_PROD_PRIVATEKEY }}
31+
DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PROD_PATH }}
32+
DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_PROD_SERVER }}
33+
DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_PROD_URL_BASE }}
34+
DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_PROD_USER }}
7635
run: |
7736
sudo apt update
7837
sudo apt install python3-pip python3-setuptools

.github/workflows/docs_preview.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Documentation Build and Deploy CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/docs.yml'
10+
11+
jobs:
12+
13+
deploy-preview-docs:
14+
name: Deploy Documentation Preview
15+
runs-on: ubuntu-22.04
16+
defaults:
17+
run:
18+
shell: bash
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
submodules: true
23+
- uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.10'
26+
- name: Deploy Preview
27+
env:
28+
# Deploy to preview server
29+
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
30+
DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_KEY }}
31+
DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }}
32+
DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }}
33+
DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }}
34+
DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_USER }}
35+
run: |
36+
sudo apt update
37+
sudo apt install python3-pip python3-setuptools
38+
source ./docs/utils.sh
39+
add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
40+
export GIT_VER=$(git describe --always)
41+
echo "PIP install requirements..."
42+
pip3 install --user -r ./docs/requirements.txt
43+
echo "Building the Docs..."
44+
cd ./docs && build-docs -l en
45+
echo "Deploy the Docs..."
46+
deploy-docs

docs/utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function add_ssh_keys() {
55
mkdir -p ~/.ssh
66
chmod 700 ~/.ssh
77
echo -n "${key_string}" >~/.ssh/id_rsa_base64
8-
base64 -w 0 ~/.ssh/id_rsa_base64 | base64 -di >~/.ssh/id_rsa
8+
base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 >~/.ssh/id_rsa
99
chmod 600 ~/.ssh/id_rsa
1010
}
1111

0 commit comments

Comments
 (0)