From 4d1a03ea869e48bd7cb6a2fb748871d97d6cf420 Mon Sep 17 00:00:00 2001 From: zxb Date: Thu, 10 Apr 2025 12:56:17 +0800 Subject: [PATCH] =?UTF-8?q?ci(docker):=20=E7=B2=BE=E7=AE=80=20Docker=20?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=9E=84=E5=BB=BA=E6=B5=81=E7=A8=8B-=20?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=BA=86=E7=89=88=E6=9C=AC=E5=8F=B7=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=80=BB=E8=BE=91=EF=BC=8C=E6=94=B9=E4=B8=BA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=BD=93=E5=89=8D=E6=97=A5=E6=9C=9F=E4=BD=9C=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E7=AD=BE-=20=E5=88=A0=E9=99=A4=E4=BA=86=20manager-web?= =?UTF-8?q?=20=E9=95=9C=E5=83=8F=E7=9A=84=E6=9E=84=E5=BB=BA=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4=20-=E7=AE=80=E5=8C=96=E4=BA=86=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E8=A7=A6=E5=8F=91=E6=9D=A1=E4=BB=B6=EF=BC=8C=E4=BB=85?= =?UTF-8?q?=E4=BF=9D=E7=95=99=20push=20=E5=92=8C=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=20-=20=E4=BC=98=E5=8C=96=E4=BA=86=20Docker?= =?UTF-8?q?=20=E8=B5=84=E6=BA=90=E6=B8=85=E7=90=86=E5=92=8C=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image.yml | 40 ++++-------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 42a58dbe6..b0e05896d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,11 +1,7 @@ name: Docker Image CI - on: push: - tags: - - 'v*.*.*' # 只在以 v 开头的标签推送时触发,例如 v1.0.0 workflow_dispatch: - jobs: release: name: Release Docker images @@ -20,54 +16,28 @@ jobs: run: | df -h docker system df - - name: Clean up Docker resources run: | docker system prune -af docker builder prune -af - - name: Checkout code uses: actions/checkout@v4 - - name: Set up Docker Buildx 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 - id: get_version - run: | - if [[ "$GITHUB_REF" =~ ^refs/tags/v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then - echo "VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV - echo "IS_VERSION=true" >> $GITHUB_ENV - else - echo "VERSION=latest" >> $GITHUB_ENV - echo "IS_VERSION=false" >> $GITHUB_ENV - fi - - # 构建 xiaozhi-server 镜像 + - name: Get current date + id: date + run: echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - name: Build and push xiaozhi-server uses: docker/build-push-action@v6 with: context: . file: Dockerfile-server push: true - tags: | - ${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:server_{1}\nghcr.io/{0}:server_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:server_latest', github.repository) }} - platforms: linux/amd64,linux/arm64 - - # 构建 manager-api 镜像 - - name: Build and push manager-web - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile-web - push: true - tags: | - ${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:web_{1}\nghcr.io/{0}:web_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:web_latest', github.repository) }} - platforms: linux/amd64,linux/arm64 \ No newline at end of file + tags: ghcr.io/${{ github.repository_owner }}/xiaozhi-server:${{ steps.date.outputs.date }} + platforms: linux/arm64 \ No newline at end of file