ci: 自动构建image

This commit is contained in:
xiehao.0527 2025-07-03 11:46:20 +08:00
parent 10dc679d7e
commit 2b4f3d80a5

View file

@ -2,6 +2,8 @@ name: Docker Image CI
on: on:
push: push:
branches:
- main # 推送main分支时触发
tags: tags:
- 'v*.*.*' # 只在以 v 开头的标签推送时触发,例如 v1.0.0 - 'v*.*.*' # 只在以 v 开头的标签推送时触发,例如 v1.0.0
workflow_dispatch: workflow_dispatch:
@ -9,7 +11,7 @@ on:
jobs: jobs:
release: release:
name: Release Docker images name: Release Docker images
runs-on: ubuntu-latest runs-on: ecs-volc
permissions: permissions:
packages: write packages: write
contents: write contents: write
@ -32,13 +34,6 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
- name: Extract version from tag - name: Extract version from tag
id: get_version id: get_version
run: | run: |
@ -58,8 +53,8 @@ jobs:
file: Dockerfile-server file: Dockerfile-server
push: true push: true
tags: | tags: |
${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:server_{1},ghcr.io/{0}:server_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:server_latest', github.repository) }} r-veen.volces.com/vei/public/xiaozhi-server:api
platforms: linux/amd64,linux/arm64 platforms: linux/amd64
# 构建 manager-api 镜像 # 构建 manager-api 镜像
- name: Build and push manager-web - name: Build and push manager-web
@ -69,5 +64,5 @@ jobs:
file: Dockerfile-web file: Dockerfile-web
push: true push: true
tags: | tags: |
${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:web_{1},ghcr.io/{0}:web_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:web_latest', github.repository) }} r-veen.volces.com/vei/public/xiaozhi-server:web
platforms: linux/amd64,linux/arm64 platforms: linux/amd64