diff --git a/docs/website/docs/index.md b/docs/website/docs/index.md new file mode 100644 index 0000000..ceea72a --- /dev/null +++ b/docs/website/docs/index.md @@ -0,0 +1,3 @@ +# Home + +The OpenSavvy Playground is a project template with pre-configured CI/CD, documentation generator, etc. diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml new file mode 100644 index 0000000..e2cc761 --- /dev/null +++ b/docs/website/mkdocs.yml @@ -0,0 +1,35 @@ +site_name: OpenSavvy Playground +site_author: OpenSavvy & contributors +site_description: > + Project template with CI/CD and IDE configuration. + +theme: + name: material + features: + - announce.dismiss + - content.action.edit + - content.action.view + - content.code.annotate + - content.code.copy + # - content.code.select + # - content.footnote.tooltips + # - content.tabs.link + - content.tooltips + # - header.autohide + # - navigation.expand + - navigation.footer + - navigation.indexes + # - navigation.instant + # - navigation.instant.prefetch + # - navigation.instant.progress + # - navigation.prune + - navigation.sections + - navigation.tabs + # - navigation.tabs.sticky + - navigation.top + - navigation.tracking + - search.highlight + - search.share + - search.suggest + - toc.follow + # - toc.integrate -- 2.51.2 From 3ef515826992398e09a5318540b084b3357f7399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Tue, 23 Apr 2024 13:54:34 +0200 Subject: [PATCH 2/7] ci(gitlab): Generate the documentation website --- .gitlab-ci.yml | 2 ++ docs/website/.gitlab-ci.yml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 docs/website/.gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f132dfd..afab986 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,8 @@ include: - remote: https://gitlab.com/opensavvy/ci-templates/-/raw/main/version.gitlab-ci.yml - remote: https://gitlab.com/opensavvy/ci-templates/-/raw/main/mirror.gitlab-ci.yml + - local: docs/website/.gitlab-ci.yml + variables: # https://gitlab.com/opensavvy/automation/containers ci_containers: 0.3.0 diff --git a/docs/website/.gitlab-ci.yml b/docs/website/.gitlab-ci.yml new file mode 100644 index 0000000..7774f43 --- /dev/null +++ b/docs/website/.gitlab-ci.yml @@ -0,0 +1,18 @@ + +mkdocs: + image: + name: squidfunk/mkdocs-material + entrypoint: [ "/bin/sh", "-c" ] + stage: build + + before_script: + - cd docs/website + - ls + + script: + - pwd + - mkdocs build --site-dir ../../docs-website + + artifacts: + paths: + - docs-website -- 2.51.2 From ea79ba03a616820fb61bcf3e2e2b0139fd2243d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Tue, 23 Apr 2024 14:46:25 +0200 Subject: [PATCH 3/7] ci(gitlab): Script to generate the review app URL for a job's artifacts --- .gitlab/ci/review-url.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 .gitlab/ci/review-url.sh diff --git a/.gitlab/ci/review-url.sh b/.gitlab/ci/review-url.sh new file mode 100755 index 0000000..b52fe4d --- /dev/null +++ b/.gitlab/ci/review-url.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +################################################################################ +# +# Generates the review app URL for a given CI job. +# +# +# Usage: +# .gitlab/ci/review-url.sh ARTIFACT_PATH +# +################################################################################ + +# Yes, there are no predefined variables for this, +# so we use a ugly rewrite. +# https://gitlab.com/gitlab-org/gitlab/-/issues/450912 + +root=$(echo "$CI_PAGES_URL" | sed 's // XSTARTX ;s / /-/ ;s XSTARTX // ') + +echo "$root/-/jobs/$CI_JOB_ID/artifacts/$1" -- 2.51.2 From 2255d2d0633c19bc4b6cb7905b75ea7c5283d16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Tue, 23 Apr 2024 14:46:46 +0200 Subject: [PATCH 4/7] ci(gitlab): Enable review apps for the mkdocs site --- docs/website/.gitlab-ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/website/.gitlab-ci.yml b/docs/website/.gitlab-ci.yml index 7774f43..6934a77 100644 --- a/docs/website/.gitlab-ci.yml +++ b/docs/website/.gitlab-ci.yml @@ -13,6 +13,16 @@ mkdocs: - pwd - mkdocs build --site-dir ../../docs-website + after_script: + - echo "URL=$(.gitlab/ci/review-url.sh docs-website/index.html)" >>docs.env + artifacts: paths: - docs-website + reports: + dotenv: docs.env + + environment: + name: review/$CI_COMMIT_REF_SLUG/docs + url: $URL + deployment_tier: development -- 2.51.2 From efdaad6d2f80153a5ffa7e4af99632d7ffdb8098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Tue, 23 Apr 2024 14:51:02 +0200 Subject: [PATCH 5/7] ci(gitlab): Add region markers to the Playground mirroring logic --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index afab986..77c3965 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,6 +27,8 @@ hello-world: - echo 'Hello world' interruptible: true +# region Automatically mirror the previous layer of the playground + mirror-playground: stage: deploy extends: [ .os.mirror ] @@ -46,3 +48,5 @@ mirror-playground: - if: $CI_PIPELINE_SOURCE == 'schedule' - when: manual allow_failure: true + +# endregion -- 2.51.2 From ac879fe79a08875ba4c3e37e2fc4779a4f912e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Tue, 23 Apr 2024 14:52:57 +0200 Subject: [PATCH 6/7] ci(gitlab): Publish the mkdocs website to GitLab Pages --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77c3965..58358b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,3 +50,25 @@ mirror-playground: allow_failure: true # endregion +# region GitLab Pages + +pages: + image: alpine:latest + stage: deploy + needs: + - job: mkdocs + artifacts: true + + script: + - mkdir -p public + - mv docs-website public/docs + + artifacts: + paths: + - public + + rules: + - if: $CI_COMMIT_TAG + interruptible: false + +# endregion -- 2.51.2 From e2190a000509f06f680788519ba6b35f10a92049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Tue, 23 Apr 2024 15:11:15 +0200 Subject: [PATCH 7/7] ci(gitlab): Link the mkdocs site to the GitLab repository --- docs/website/.gitlab-ci.yml | 2 ++ docs/website/mkdocs.yml | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/docs/website/.gitlab-ci.yml b/docs/website/.gitlab-ci.yml index 6934a77..cbe109a 100644 --- a/docs/website/.gitlab-ci.yml +++ b/docs/website/.gitlab-ci.yml @@ -8,6 +8,8 @@ mkdocs: before_script: - cd docs/website - ls + - 'echo "repo_url: $CI_PROJECT_URL">>mkdocs.yml' + - 'echo "repo_name: $CI_PROJECT_TITLE">>mkdocs.yml' script: - pwd diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml index e2cc761..787b9ef 100644 --- a/docs/website/mkdocs.yml +++ b/docs/website/mkdocs.yml @@ -33,3 +33,8 @@ theme: - search.suggest - toc.follow # - toc.integrate + icon: + edit: material/pencil + view: material/eye + +edit_uri: edit/main/docs/website