Files
documentation/.gitlab-ci.yml
2021-07-15 12:47:59 +02:00

74 lines
2.0 KiB
YAML

image: monachus/hugo
variables:
GIT_SUBMODULE_STRATEGY: recursive
ARTIFACT_NAME: documentation
REPO_NAME: kerberos-io/${ARTIFACT_NAME}
REPO_DIR: gitlab.com/${REPO_NAME}
CI_VERSION: "1.0.${CI_PIPELINE_ID}"
DOCKER_HOST: tcp://localhost:2375
NAMESPACE: kerberos
REGISTRY: registry.gitlab.com/kerberos-io/${ARTIFACT_NAME}
stages:
- build-staging # Staging environment -> develop
- build-production # Production environment -> master
- docker # All branches
- kubernetes-staging # Staging environment -> develop
- kubernetes-production # Production environment -> master
build-staging:
image: node:10.22.1
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
stage: docker
services:
- docker:18.09.7-dind
script:
- docker login -u ${gitlab_id} -p ${gitlab_token} $CI_REGISTRY
- 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
environment:
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
stage: kubernetes-production
environment:
name: production
script:
- kubectl patch deployment kerberos-documentation --patch="{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"kerberos-documentation\",\"image\":\"${REGISTRY}:${CI_VERSION}\"}]}}}}" -n kerberos-ecosystem
only:
- master