feat(ci): 更新Docker发布工作流

This commit is contained in:
严浩
2025-04-02 13:49:05 +08:00
parent c0a27d0542
commit 360bc9e48d
+16 -8
View File
@@ -2,8 +2,6 @@ name: Docker Image CI
on: on:
push: push:
# branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request: pull_request:
branches: [ "main" ] branches: [ "main" ]
@@ -43,20 +41,30 @@ jobs:
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: | tags: |
type=raw,value=latest,enable={{is_default_branch}} # https://github.com/docker/metadata-action/tree/v5/?tab=readme-ov-file#semver
# Event: push, Ref: refs/head/main, Tags: main
# Event: push tag, Ref: refs/tags/v1.2.3, Tags: 1.2.3, 1.2, 1, latest
# Event: push tag, Ref: refs/tags/v2.0.8-rc1, Tags: 2.0.8-rc1
type=ref,event=branch
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}
type=sha,format=long type=semver,pattern={{major}}
labels: | labels: |
org.opencontainers.image.description=OpenAI API Compatible Server org.opencontainers.image.description=OpenAI API Compatible Server
org.opencontainers.image.source=${{ github.event.repository.html_url }} org.opencontainers.image.source=${{ github.event.repository.html_url }}
- name: Build and push Docker image - name: Set up QEMU
uses: docker/build-push-action@v5 uses: docker/setup-qemu-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with: with:
file: Dockerfile
context: . context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
load: false
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max cache-to: type=gha,scope=${{ github.workflow }}