Files
mai-bot/helm-chart/.gitlab-ci.yml
zhangxinhui02 b82cae06f7 调整CI
2025-09-23 02:42:13 +08:00

68 lines
2.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
stages:
- initialize-maibot-git-repo
- build
- package
# 查询并将麦麦仓库的工作区置为最后一个tag的版本
initialize-maibot-git-repo:
stage: initialize-maibot-git-repo
image: reg.mikumikumi.xyz/base/git:latest
cache:
key: git-repo
policy: push
paths:
- target-repo/
script:
- git clone https://github.com/MaiM-with-u/MaiBot.git target-repo/
- cd target-repo/
- export MAIBOT_VERSION=$(git describe --tags --abbrev=0)
- echo "Current version is `${MAIBOT_VERSION}`"
- git reset --hard ${MAIBOT_VERSION}
- echo ${MAIBOT_VERSION} > MAIBOT_VERSION
# 构建最后一个tag的麦麦本体的镜像
build-core:
stage: build
image: reg.mikumikumi.xyz/base/kaniko-builder:latest
cache:
key: git-repo
policy: pull
paths:
- target-repo/
script:
- cd target-repo/
- export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:$(cat MAIBOT_VERSION)"
- git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM
- build
- rm -rf target-repo/* target-repo/.*
# 将Helm Chart版本作为tag构建并推送镜像
build-adapter-cm-generator:
stage: build
image: reg.mikumikumi.xyz/base/kaniko-builder:latest
rules:
- changes:
- helm-chart/adapter-cm-generator/**
script:
- export BUILD_CONTEXT=helm-chart/adapter-cm-generator
- export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator
- export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2)
- export BUILD_ARGS="--destination ${TMP_DST}:${CHART_VERSION} --destination ${TMP_DST}:latest"
- build
# 打包并推送helm chart
package-helm-chart:
stage: package
image: reg.mikumikumi.xyz/mirror/helm:latest
rules:
- changes:
- helm-chart/files/**
- helm-chart/templates/**
- helm-chart/Chart.yaml
- 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