From 51d871236e251fa93abd510005006b6b097ce82f Mon Sep 17 00:00:00 2001 From: cedricve Date: Thu, 15 Jul 2021 12:47:59 +0200 Subject: [PATCH] add staging build step --- .gitlab-ci.yml | 30 ++++++++++++++++++++++++------ config/staging/params.toml | 1 + package.json | 3 ++- 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 config/staging/params.toml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da6bfcf..34d2fb0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,20 +11,35 @@ variables: REGISTRY: registry.gitlab.com/kerberos-io/${ARTIFACT_NAME} stages: - - pages - - docker - - kubernetes-staging - - kubernetes-production + - build-staging # Staging environment -> develop + - build-production # Production environment -> master + - docker # All branches + - kubernetes-staging # Staging environment -> develop + - kubernetes-production # Production environment -> master -pages: +build-staging: image: node:10.22.1 - stage: pages + stage: build + script: + - yarn + - yarn run build-staging + artifacts: + paths: + - public + except: + - master + +build-production: + image: node:10.22.1 + stage: build script: - yarn - yarn run build artifacts: paths: - public + only: + - master docker: image: docker:stable @@ -36,6 +51,7 @@ docker: - docker build --build-arg gitlab_id=${gitlab_id} --build-arg gitlab_token=${gitlab_token} -t $CI_REGISTRY/$REPO_NAME:$CI_VERSION . - docker push $CI_REGISTRY/$REPO_NAME:$CI_VERSION + kubernetes-staging: image: registry.cn-hangzhou.aliyuncs.com/haoshuwei24/kubectl:1.16.6 stage: kubernetes-staging @@ -43,6 +59,8 @@ kubernetes-staging: name: staging script: - kubectl patch deployment kerberos-documentation --patch="{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"kerberos-documentation\",\"image\":\"${REGISTRY}:${CI_VERSION}\"}]}}}}" -n kerberos-ecosystem + except: + - master kubernetes-production: image: registry.cn-hangzhou.aliyuncs.com/haoshuwei24/kubectl:1.16.6 diff --git a/config/staging/params.toml b/config/staging/params.toml new file mode 100644 index 0000000..899a3cf --- /dev/null +++ b/config/staging/params.toml @@ -0,0 +1 @@ +env = "staging" diff --git a/package.json b/package.json index 491590b..2639437 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "prestart": "npm run clean", "start": "hugo server --bind=0.0.0.0 --disableFastRender", "prebuild": "npm run clean", - "build": "hugo --gc --minify && npm run build:functions", + "build": "hugo --gc --minify --environment production && npm run build:functions", + "build-staging": "hugo --gc --minify --environment staging && npm run build:functions", "build:functions": "netlify-lambda build assets/lambda", "build:preview": "npm run build -D -F", "clean": "rimraf public resources functions",