update:Docker Image CI/CD

This commit is contained in:
jiangrui
2025-03-02 08:40:55 +08:00
parent 32bf77c3e0
commit cd7183f206

View File

@@ -2,6 +2,7 @@ name: Docker Image CI/CD
on:
push:
tags: [ "v*.*.*" ] # 支持标签触发(如 v1.0.0
workflow_dispatch: # 添加手动触发
jobs:
build-and-push:
runs-on: ubuntu-latest
@@ -26,11 +27,18 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 设置 QEMU 支持多架构
uses: docker/setup-qemu-action@v2
- name: 设置 Docker Buildx
uses: docker/setup-buildx-action@v2
- name: 构建并推送 Docker 镜像
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name == 'push' }} # 仅推送代码时上传镜像
platforms: linux/amd64,linux/arm64 # 指定架构x86_64 和 ARM64
push: true
tags: |
ghcr.io/${{ env.LOWER_NAME }}:latest
ghcr.io/${{ env.LOWER_NAME }}:${{ github.sha }}