im_workbench had no CI/CD before. Build+push under the mutable :test tag the cluster overlay tracks, then roll the k3s deployment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
name: Deploy im-workbench (k3s test cluster)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
image_tag:
|
|
description: '镜像tag,默认为 test(与集群 kustomization 里的 newTag 一致)'
|
|
required: false
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: deploy-host
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: 确定镜像tag
|
|
id: vars
|
|
run: |
|
|
TAG="${{ github.event.inputs.image_tag }}"
|
|
[ -z "$TAG" ] && TAG=test
|
|
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: 登录镜像仓库
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.118im.com -u admin --password-stdin
|
|
|
|
- name: 构建并推送镜像
|
|
run: |
|
|
docker build -t git.118im.com/im_team/im-workbench:${{ steps.vars.outputs.tag }} .
|
|
docker push git.118im.com/im_team/im-workbench:${{ steps.vars.outputs.tag }}
|
|
|
|
- name: 部署到k3s测试集群
|
|
run: |
|
|
mkdir -p ~/.kube
|
|
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
|
|
chmod 600 ~/.kube/config
|
|
kubectl rollout restart deployment/im-workbench -n workbench-system
|
|
kubectl rollout status deployment/im-workbench -n workbench-system --timeout=120s
|