Skip to content

Commit

Permalink
Merge branch 'feature/support_alternative_master_branch' into 'master'
Browse files Browse the repository at this point in the history
Add env. variable for configuring master branch name

See merge request espressif/esp-docs!35
  • Loading branch information
ESP-Marius committed Jun 30, 2022
2 parents b6765cc + 027be85 commit c11011d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
13 changes: 9 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

stages:
- check
- test
Expand Down Expand Up @@ -99,14 +100,16 @@ build_idf_docs_html:
- .build_template
variables:
DOCS_DIR: $CI_PROJECT_DIR/esp-idf/docs
IDF_COMMIT_ID: 3faf5ba8f784f
IDF_COMMIT_ID: 7d680980894fbcc1532f6934c1e3a2f0f8181d64
script:
# add gitlab ssh key
- cit_add_ssh_key "${GITLAB_KEY_PEM}"
- git clone "${IDF_REPO}"
- $ESP_DOCS_PATH/ci/set_repo.sh $IDF_COMMIT_ID $IDF_PATH
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install
- $IDF_PATH/tools/idf_tools.py install-python-env
- eval "$($IDF_PATH/tools/idf_tools.py export)"
- pip install $ESP_DOCS_PATH
- cd $DOCS_DIR
- build-docs --skip-reqs-check -l $DOCLANG -t $DOCTGT
parallel:
Expand All @@ -119,14 +122,16 @@ build_idf_docs_pdf:
- .build_template
variables:
DOCS_DIR: $CI_PROJECT_DIR/esp-idf/docs
IDF_COMMIT_ID: 3faf5ba8f784f
IDF_COMMIT_ID: 7d680980894fbcc1532f6934c1e3a2f0f8181d64
script:
# add gitlab ssh key
- cit_add_ssh_key "${GITLAB_KEY_PEM}"
- git clone "${IDF_REPO}"
- $ESP_DOCS_PATH/ci/set_repo.sh $IDF_COMMIT_ID $IDF_PATH
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install
- $IDF_PATH/tools/idf_tools.py install-python-env
- eval "$($IDF_PATH/tools/idf_tools.py export)"
- pip install $ESP_DOCS_PATH
- cd $DOCS_DIR
- build-docs --skip-reqs-check -l $DOCLANG -t $DOCTGT -bs latex
parallel:
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = esp-docs
version = 1.1.0
version = 1.2.0
author = Espressif
author_email = [email protected]
description = Documentation building package used at Espressif
Expand Down Expand Up @@ -35,7 +35,7 @@ install_requires =
nwdiag==2.0.0
recommonmark
sphinx_selective_exclude==1.0.3
sphinx_idf_theme==1.0.1
sphinx_idf_theme==1.1.0

[options.packages.find]
where = src
Expand Down
3 changes: 3 additions & 0 deletions src/esp_docs/conf_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@
'github_version': get_github_rev(),
}

# Set optional name used by latest branch (defaults to "master")
latest_branch_name = os.environ.get('ESP_DOCS_LATEST_BRANCH_NAME', 'master')

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
Expand Down
4 changes: 3 additions & 1 deletion src/esp_docs/sanitize_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def sanitize_version(original_version):
except KeyError:
version = original_version

if version == 'master':
latest_branch_name = os.environ.get('ESP_DOCS_LATEST_BRANCH_NAME', 'master')

if version == latest_branch_name:
return 'latest'

version = version.replace('/', '-')
Expand Down

0 comments on commit c11011d

Please sign in to comment.