answer/.gitlab-ci.yml

67 lines
1.5 KiB
YAML

include:
- project: "segmentfault/devops/templates"
file: ".docker-build-push.yml"
- project: "segmentfault/devops/templates"
file: ".deploy-helm.yml"
stages:
- compile-html
- compile-golang
- push
- deploy-dev
"compile the html and other static files":
image: node:16
stage: compile-html
tags:
- runner-nanjing
before_script:
- npm config set registry https://repo.huaweicloud.com/repository/npm/
- make install-ui-packages
script:
- make ui
artifacts:
paths:
- ./build
"compile the golang project":
image: golang:1.18
stage: compile-golang
before_script:
- export GOPROXY="https://goproxy.cn"
- export GOPRIVATE=git.backyard.segmentfault.com
- sh ./script/prebuild.sh
script:
- make build
artifacts:
paths:
- ./answer
"build docker images and push":
stage: push
extends: .docker-build-push
only:
- dev
- master
- main
variables:
DockerNamespace: sf_app
DockerImage: answer
DockerTag: "$CI_COMMIT_SHORT_SHA latest"
DockerfilePath: .
PushPolicy: qingcloud
"deploy-to-local-develop-environment":
stage: deploy-dev
extends: .deploy-helm
only:
- main
variables:
LoadBalancerIP: 10.0.10.98
KubernetesCluster: dev
KubernetesNamespace: "sf-web"
InstallArgs: --set service.loadBalancerIP=${LoadBalancerIP} --set image.tag=$CI_COMMIT_SHORT_SHA --set replicaCount=1 --set serivce.targetPort=80
ChartName: answer
InstallPolicy: replace