diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 84a79d8..d67c967 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -2,15 +2,8 @@ name: Build and Push Multi-Arch Docker Image on: push: - branches: - - main - - master tags: - 'v*' - pull_request: - branches: - - main - - master workflow_dispatch: # 允许手动触发 env: @@ -37,7 +30,6 @@ jobs: network=host - name: Login to Docker Hub - if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -66,7 +58,7 @@ jobs: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha @@ -75,7 +67,7 @@ jobs: BUILDKIT_INLINE_CACHE=1 - name: Update Docker Hub Description - if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') + if: startsWith(github.ref, 'refs/tags/v') uses: peter-evans/dockerhub-description@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }}