fix: 修复 Docker 镜像版本号与 Release 版本号不一致的问题

- 在 auto-release.yml 中集成 Docker 构建步骤,确保版本号一致性
- 优化 docker-publish.yml 的标签生成策略,添加 sha- 前缀避免混淆
- 现在每次自动发布时会同时构建对应版本的 Docker 镜像

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
shaw
2025-07-20 20:33:00 +08:00
parent b77c600f05
commit 7e5fb514cb
2 changed files with 37 additions and 2 deletions

View File

@@ -142,6 +142,41 @@ jobs:
git push origin main
fi
# Docker 构建和推送步骤
- name: Set up QEMU
if: steps.check_changes.outputs.has_changes == 'true'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: steps.check_changes.outputs.has_changes == 'true'
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: steps.check_changes.outputs.has_changes == 'true'
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
if: steps.check_changes.outputs.has_changes == 'true'
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/claude-relay-service:${{ steps.next_version.outputs.new_tag }}
${{ secrets.DOCKERHUB_USERNAME }}/claude-relay-service:latest
${{ secrets.DOCKERHUB_USERNAME }}/claude-relay-service:${{ steps.next_version.outputs.new_version }}
labels: |
org.opencontainers.image.version=${{ steps.next_version.outputs.new_version }}
org.opencontainers.image.created=${{ steps.next_version.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Send Telegram Notification
if: steps.check_changes.outputs.has_changes == 'true' && env.TELEGRAM_BOT_TOKEN != '' && env.TELEGRAM_CHAT_ID != ''
env:

View File

@@ -46,10 +46,10 @@ jobs:
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{version}},priority=1000
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=sha,prefix=sha-,format=short
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image