diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b715c31 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,39 @@ +stages: + - prepare + - test + - build + - build-image + - deploy + +include: + - "ci/build/*.inc.yml" + - "ci/build/*/*.inc.yml" + - "ci/variables.yml" + - "ci/rules.yml" + +# default: +# image: harbor.vimpelcom.ru/dockerhub/library/docker:20.10.11-dind + +# cache: +# paths: +# - node_modules/ + +# stages: +# - build +# - package +# - deploy + +# variables: +# DIST_DIR: "./src/.vitepress/dist" +# DMZ_DIST_DIR: "./dmz-dist" +# CONTAINER_REGISTRY: harbor.vimpelcom.ru +# PRODUCT_FEATURE: vega/feature +# PRODUCT_FEATURE_STAND: vega/feature/stand +# PRODUCT_STAGE: vega/stage +# PRODUCT_DMZ: vega/dmz +# PRODUCT_PROD: vega +# IMAGE_NAME: docs + +# include: +# - ci/feature.yml +# - ci/develop.yml diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8a9ecc2 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1 \ No newline at end of file diff --git a/ci/build/npm/build.inc.yml b/ci/build/npm/build.inc.yml new file mode 100644 index 0000000..a6db086 --- /dev/null +++ b/ci/build/npm/build.inc.yml @@ -0,0 +1,45 @@ +# - > переносы строк удаляются +# - | переносы строк не удаляются + +build-npm: + image: harbor.vimpelcom.ru/dockerhub/library/node:lts + stage: build + cache: + - key: + files: + - package.json + paths: + - node_modules/ + script: + # - GREEN=$'\033[0;32m' + # - RED=$'\033[0;31m' + # - BLUE=$'\033[0;36m' + # - WHITE=$'\033[0;37m' + # - RESET=$'\033[0m' + + # - | + # if [ -f "${CI_PROJECT_DIR}/VERSION" ]; then + # APPVERSION=$(cat ${CI_PROJECT_DIR}/VERSION) + # fi + # echo "APPVERSION(VERSION) ${APPVERSION}" + + # if [[ -z "$APPVERSION" ]]; then + # echo "APPVERSION is null" + # exit 1 + # fi + # - echo VITE_VERSION = "$APPVERSION" >> .env + + # - export PRODUCT="${PRODUCT_CLOUD}" + + - npm install + - npm run build + needs: + - job: test-npm + artifacts: true # true by default, grabs `node_modules` + artifacts: + paths: + - "$NPM_DIST_DIR" + reports: + dotenv: .env + rules: + - !reference [.build-npm-rules, rules] diff --git a/ci/rules.yml b/ci/rules.yml new file mode 100644 index 0000000..1b74a07 --- /dev/null +++ b/ci/rules.yml @@ -0,0 +1,8 @@ +.build-npm-rules: + rules: + - if: $CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "merge_request_event" + when: never + - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main" + exists: + - .npmrc + - ./*/.npmrc diff --git a/ci/variables.yml b/ci/variables.yml new file mode 100644 index 0000000..7aaa500 --- /dev/null +++ b/ci/variables.yml @@ -0,0 +1,13 @@ +variables: + TEAM_NAME: vega + IMAGE_REGISTRY: harbor.vimpelcom.ru + CONTAINER_REGISTRY: ${IMAGE_REGISTRY} + NEXUS: https://nexus.vimpelcom.ru + + NPM_DIST_DIR: "./src/.vitepress/dist" + IMAGE_NAME: ${CI_PROJECT_NAME} + PRODUCT_RELEASE: ${TEAM_NAME} + PRODUCT_DEVELOP: ${TEAM_NAME}/stage + PRODUCT_FEATURE: ${TEAM_NAME}/feature + PRODUCT_CLOUD: ${TEAM_NAME}/cloud + PRODUCT_VERSION: ${APPVERSION} diff --git a/src/.vitepress/config.mts b/src/.vitepress/config.mts index 8bbe209..f32d94b 100644 --- a/src/.vitepress/config.mts +++ b/src/.vitepress/config.mts @@ -37,15 +37,12 @@ const gitlab = ` ` -const new_version = process.env?.VITE_NEW_VERSION; -console.log({ base: typeof new_version !== 'undefined' ? '/' : '/docs/' }) - // https://vitepress.dev/reference/site-config export default defineConfig({ title: "BeeCloud Docs", description: "Документация публичного облака", head: [['link', { rel: 'icon', href: '/favicon.svg' }]], - base: typeof new_version !== 'undefined' ? '/' : '/docs/', + base: '/', markdown: { config(md) { md.use(tabsMarkdownPlugin)