From bff0f2d30111e5cc18fd4812a4f79d79cc3ebca1 Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Sat, 24 Dec 2022 20:54:44 +0800 Subject: [PATCH] chore(CI): docker build Signed-off-by: Bo-Yi.Wu --- .github/workflows/build.yaml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index aa54a431..3f361196 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -54,7 +54,6 @@ jobs: - name: Docker meta for linux amd64 - if: github.event_name == 'push' id: meta-linux-amd64 uses: docker/metadata-action@v4 with: @@ -67,22 +66,23 @@ jobs: tags: | type=raw,value= type=raw,value=latest,suffix= + type=semver,event=tag,pattern={{version}},suffix=-linux-amd64 + type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-amd64 + type=semver,event=tag,pattern={{major}},suffix=-linux-amd64 - name: Build and push linux amd64 - if: github.event_name == 'push' uses: docker/build-push-action@v3 with: context: . file: docker/Dockerfile.linux.amd64 platforms: linux/amd64 - push: ${{ github.event_name == 'push' }} + push: true tags: ${{ steps.meta-linux-amd64.outputs.tags }} labels: ${{ steps.meta-linux-amd64.outputs.labels }} - name: Docker meta for linux arm64 - if: github.event_name == 'push' id: meta-linux-arm64 uses: docker/metadata-action@v4 with: @@ -94,22 +94,23 @@ jobs: ghcr.io/appleboy/gorush tags: | type=raw,value= + type=semver,event=tag,pattern={{version}},suffix=-linux-arm64 + type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm64 + type=semver,event=tag,pattern={{major}},suffix=-linux-arm64 - name: Build and push linux arm64 - if: github.event_name == 'push' uses: docker/build-push-action@v3 with: context: . file: docker/Dockerfile.linux.arm64 platforms: linux/arm64 - push: ${{ github.event_name == 'push' }} + push: true tags: ${{ steps.meta-linux-arm64.outputs.tags }} labels: ${{ steps.meta-linux-arm64.outputs.labels }} - name: Docker meta for linux arm - if: github.event_name == 'push' id: meta-linux-arm uses: docker/metadata-action@v4 with: @@ -121,15 +122,17 @@ jobs: ghcr.io/appleboy/gorush tags: | type=raw,value= + type=semver,event=tag,pattern={{version}},suffix=-linux-arm + type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm + type=semver,event=tag,pattern={{major}},suffix=-linux-arm - name: Build and push linux arm - if: github.event_name == 'push' uses: docker/build-push-action@v3 with: context: . file: docker/Dockerfile.linux.arm platforms: linux/arm - push: ${{ github.event_name == 'push' }} + push: true tags: ${{ steps.meta-linux-arm.outputs.tags }} labels: ${{ steps.meta-linux-arm.outputs.labels }}