mirror of
https://github.com/espressif/esptool.git
synced 2025-10-14 02:43:11 +08:00
docs: Build and deploy docs with GL CI
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
# Gitlab CI config
|
||||
#
|
||||
# Note: When updating, please also update esptool_tests.yml GH Actions workflow file
|
||||
# Note: When updating, please also update test_esptool.yml GH Actions workflow file
|
||||
stages:
|
||||
- rfc2217_test
|
||||
- test
|
||||
- report
|
||||
- build_docs
|
||||
- deploy_docs
|
||||
|
||||
# cache the pip download directory in all jobs
|
||||
variables:
|
||||
@@ -250,3 +252,67 @@ combine_reports:
|
||||
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage report
|
||||
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage html -d html_report
|
||||
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage xml -o cobertura_report.xml
|
||||
|
||||
build_docs:
|
||||
stage: build_docs
|
||||
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env:v4.4-1-v4
|
||||
tags:
|
||||
- build_docs
|
||||
only:
|
||||
changes:
|
||||
- "docs/**/*"
|
||||
needs: []
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- docs/_build/*/*/*.txt
|
||||
- docs/_build/*/*/html/*
|
||||
expire_in: 4 days
|
||||
script:
|
||||
- cd docs
|
||||
- pip install -r requirements.txt
|
||||
- build-docs -l en
|
||||
|
||||
.deploy_docs_template:
|
||||
stage: deploy_docs
|
||||
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env:v4.4-1-v4
|
||||
tags:
|
||||
- deploy
|
||||
needs:
|
||||
- build_docs
|
||||
only:
|
||||
changes:
|
||||
- "docs/**/*"
|
||||
script:
|
||||
- source ${CI_PROJECT_DIR}/docs/utils.sh
|
||||
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
|
||||
- export GIT_VER=$(git describe --always)
|
||||
- pip install -r ${CI_PROJECT_DIR}/docs/requirements.txt
|
||||
- deploy-docs
|
||||
|
||||
deploy_docs_preview:
|
||||
extends:
|
||||
- .deploy_docs_template
|
||||
variables:
|
||||
TYPE: "preview"
|
||||
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
|
||||
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_DEPLOY_KEY"
|
||||
DOCS_DEPLOY_SERVER: "$DOCS_SERVER"
|
||||
DOCS_DEPLOY_SERVER_USER: "$DOCS_SERVER_USER"
|
||||
DOCS_DEPLOY_PATH: "$DOCS_PATH"
|
||||
DOCS_DEPLOY_URL_BASE: "https://$DOCS_PREVIEW_SERVER_URL/docs/esptool"
|
||||
|
||||
deploy_docs_production:
|
||||
extends:
|
||||
- .deploy_docs_template
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
variables:
|
||||
TYPE: "production"
|
||||
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
|
||||
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
|
||||
DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
|
||||
DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
|
||||
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
|
||||
DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esptool"
|
||||
|
1
docs/requirements.txt
Normal file
1
docs/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
esp-docs==0.1.1
|
18
docs/utils.sh
Normal file
18
docs/utils.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
# Bash helper functions for adding SSH keys
|
||||
|
||||
function add_ssh_keys() {
|
||||
local key_string="${1}"
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
echo -n "${key_string}" >~/.ssh/id_rsa_base64
|
||||
base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 >~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
}
|
||||
|
||||
function add_doc_server_ssh_keys() {
|
||||
local key_string="${1}"
|
||||
local server_url="${2}"
|
||||
local server_user="${3}"
|
||||
add_ssh_keys "${key_string}"
|
||||
echo -e "Host ${server_url}\n\tStrictHostKeyChecking no\n\tUser ${server_user}\n" >>~/.ssh/config
|
||||
}
|
Reference in New Issue
Block a user