Skip to content

Commit

Permalink
ci/config/docs.yml: documentation jobs config
Browse files Browse the repository at this point in the history
  • Loading branch information
alesmrazek committed Nov 22, 2024
1 parent f96fcb4 commit 757610b
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ stages:
- test
- deploy
- release

include:
- ci/config/docs.yml
87 changes: 87 additions & 0 deletions ci/config/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# docs: {{{

docs:build:
stage: deploy
needs: []
script:
- git submodule update --init --recursive
- pip3 install -U -r doc/requirements.txt
- pip3 install -U sphinx_rtd_theme
- meson build_doc -Ddoc=enabled
- ninja -C build_doc doc
artifacts:
paths:
- doc/html

# This job deploys the Knot Resolver documentation into a development
# environment, which may be found at
# <https://gitlab.nic.cz/knot/knot-resolver/-/environments/folders/docs-develop>.
# The actual URL is found in the `environment.url` property, where
# $CI_PROJECT_NAMESPACE will be "knot" on the upstream GitLab.
docs:develop:
stage: deploy
needs:
- docs:build
except:
refs:
- tags
script:
- echo "Propagating artifacts into develop environment"
artifacts:
paths:
- doc/html
environment:
name: docs-develop/$CI_COMMIT_REF_NAME
url: https://www.knot-resolver.cz/documentation/artifacts/$CI_JOB_ID/index.html

# This job deploys the Knot Resolver documentation into a release environment,
# which may be found at
# <https://gitlab.nic.cz/knot/knot-resolver/-/environments/folders/docs-release>.
# The actual URL is found in the `environment.url` property, where
# $CI_PROJECT_NAMESPACE will be "knot" on the upstream GitLab.
# The job requires the `DOCS_ENV_NAME` variable to be set by the user.
docs:release:
stage: deploy
needs:
- docs:build
only:
refs:
- tags
script: echo "Propagating artifacts into release environment"
artifacts:
paths:
- doc/html
environment:
name: docs-release/$CI_COMMIT_TAG
url: https://www.knot-resolver.cz/documentation/artifacts/$CI_JOB_ID/index.html

# This job deploys the current docs as <https://knot.pages.nic.cz/knot-resolver>
pages:
stage: deploy
needs:
- docs:build
script: mv doc/html public
when: manual
artifacts:
paths:
- public

# This job pushes the Knot Resolver documentation into a new branch of the
# `websites/knot-resolver.cz` repository.
docs:website:
stage: deploy
needs:
- docs:build
when: manual
variables:
script:
- "SRC_COMMIT_REF=\"$CI_COMMIT_TAG$CI_COMMIT_BRANCH$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\""
- "git clone \"https://gitlab-ci-token:$WEBSITE_DOCS_CI_TOKEN@$CI_SERVER_HOST:$CI_SERVER_PORT/websites/knot-resolver.cz.git\" website"
- "cp --recursive --verbose \"doc/html\" \"website/content/documentation/$SRC_COMMIT_REF\""
- cd website
- "git checkout -b \"docs/$SRC_COMMIT_REF\""
- "git add \"content/documentation/$SRC_COMMIT_REF\""
- "git commit -m \"docs: $SRC_COMMIT_REF\""
- "git push --force --set-upstream origin \"docs/$SRC_COMMIT_REF\""

# }}}

0 comments on commit 757610b

Please sign in to comment.