[ci] refine docker image publishing
@@ -38,13 +38,14 @@ jobs:
- run: make metalint
docker_deploy:
+ if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
name: "publish image on dockerhub"
- if: github.event_name != 'pull_request'
needs: [test, lint]
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: docker/setup-buildx-action@v1
+ - uses: actions/checkout@v3
+ - uses: docker/setup-qemu-action@v2
+ - uses: docker/setup-buildx-action@v2
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
@@ -53,18 +54,18 @@ jobs:
${{ runner.os }}-buildx-
- name: List docker image tags
uses: docker/metadata-action@v4
- id: smarttag
+ id: dockermeta
with:
images: tsuru/client
tags: |
type=match,value=latest,pattern=\d.\d.\d
type=edge
+ type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- type=ref,event=pr,value=pr-{{branch}}
- - uses: docker/login-action@v1
+ - uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
@@ -82,9 +83,11 @@ jobs:
build-args: |
TSURU_BUILD_VERSION="${{steps.gittag.outputs.tag}}"
push: true
- tags: ${{ steps.smarttag.outputs.tags }}
+ tags: ${{ steps.dockermeta.outputs.tags }}
+ labels: ${{ steps.dockermeta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
+ platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8
deploy:
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
