MaiBot/helm-chart/.gitlab-ci.yml

46 lines
1.4 KiB
YAML

stages:
- build-image
- package-helm-chart
# 仅在helm-chart分支运行
workflow:
rules:
- if: '$CI_COMMIT_BRANCH == "helm-chart"'
- when: never
# 构建并推送processor镜像
build-preprocessor:
stage: build-image
image: reg.mikumikumi.xyz/base/kaniko-builder:latest
variables:
BUILD_NO_CACHE: true
rules:
- changes:
- helm-chart/preprocessor/**
script:
- export BUILD_CONTEXT=helm-chart/preprocessor
- export TMP_DST=reg.mikumikumi.xyz/maibot/preprocessor
- export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2)
- export BUILD_DESTINATION="${TMP_DST}:${CHART_VERSION}"
- export BUILD_ARGS="--destination ${TMP_DST}:latest"
- build
# 打包并推送helm chart
package-helm-chart:
stage: package-helm-chart
image: reg.mikumikumi.xyz/mirror/helm:latest
rules:
- changes:
- helm-chart/files/**
- helm-chart/templates/**
- helm-chart/.gitignore
- helm-chart/.helmignore
- helm-chart/Chart.yaml
- helm-chart/README.md
- helm-chart/values.yaml
script:
- export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2)
- helm registry login reg.mikumikumi.xyz --username ${CI_REGISTRY_USER} --password ${CI_REGISTRY_PASSWORD}
- helm package helm-chart
- helm push maibot-${CHART_VERSION}.tgz oci://reg.mikumikumi.xyz/maibot