def main(): # if you get KeyErrors on the following lines, it's probably because you're not running in Gitlab CI git_ver = env("GIT_VER") # output of git describe --always ci_ver = env("CI_COMMIT_REF_NAME", git_ver) # branch or tag we're building for (used for 'release' & URL) version = sanitize_version(ci_ver) print("Git version: {}".format(git_ver)) print("CI Version: {}".format(ci_ver)) print("Deployment version: {}".format(version)) if not version: raise RuntimeError("A version is needed to deploy") build_dir = env("DOCS_BUILD_DIR") # top-level local build dir, where docs have already been built if not build_dir: raise RuntimeError("Valid DOCS_BUILD_DIR is needed to deploy") url_base = env("DOCS_DEPLOY_URL_BASE") # base for HTTP URLs, used to print the URL to the log after deploying docs_server = env("DOCS_DEPLOY_SERVER") # ssh server to deploy to docs_user = env("DOCS_DEPLOY_SERVER_USER") docs_path = env("DOCS_DEPLOY_PATH") # filesystem path on DOCS_SERVER if not docs_server: raise RuntimeError("Valid DOCS_DEPLOY_SERVER is needed to deploy") if not docs_user: raise RuntimeError("Valid DOCS_DEPLOY_SERVER_USER is needed to deploy") docs_server = "{}@{}".format(docs_user, docs_server) if not docs_path: raise RuntimeError("Valid DOCS_DEPLOY_PATH is needed to deploy") print("DOCS_DEPLOY_SERVER {} DOCS_DEPLOY_PATH {}".format(docs_server, docs_path)) tarball_path, version_urls = build_doc_tarball(version, git_ver, build_dir) deploy(version, tarball_path, docs_path, docs_server) print("Docs URLs:") doc_deploy_type = os.getenv('TYPE') for vurl in version_urls: language, _, = vurl.split('/') tag = '{}'.format(language) url = "{}/{}/index.html".format(url_base, vurl) # (index.html needed for the preview server) url = re.sub(r"([^:])//", r"\1/", url) # get rid of any // that isn't in the https:// part print('[document {}][{}] {}'.format(doc_deploy_type, tag, url)) # note: it would be neater to use symlinks for stable, but because of the directory order # (language first) it's kind of a pain to do on a remote server, so we just repeat the # process but call the version 'stable' this time if is_stable_version(version): print("Deploying again as stable version...") tarball_path, version_urls = build_doc_tarball("stable", git_ver, build_dir) deploy("stable", tarball_path, docs_path, docs_server)
# The master toctree document. master_doc = 'index' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # This is the full exact version, canonical git version description # visible when you open index.html. version = subprocess.check_output(['git', 'describe']).strip().decode('utf-8') # The 'release' version is the same as version for non-CI builds, but for CI # builds on a branch then it's replaced with the branch name release = sanitize_version(version) print('Version: {0} Release: {1}'.format(version, release)) # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['**/inc/**', '_static/', '_build/**'] BT_DOCS = [ 'api-guides/blufi.rst', 'api-guides/esp-ble-mesh/**',