From afcc49348068ca43368fd30eedc162c77326c001 Mon Sep 17 00:00:00 2001 From: Lawrence Chou Date: Wed, 8 Jun 2022 23:17:20 +0800 Subject: [PATCH] Merge publish-docker-latest.yml & publish-docker-tag.yml (#2477) close #1901 --- .github/workflows/publish-docker-latest.yml | 30 ------------------- ...lish-docker-tag.yml => publish-docker.yml} | 10 +++++-- 2 files changed, 8 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/publish-docker-latest.yml rename .github/workflows/{publish-docker-tag.yml => publish-docker.yml} (67%) diff --git a/.github/workflows/publish-docker-latest.yml b/.github/workflows/publish-docker-latest.yml deleted file mode 100644 index 59cbf9123..000000000 --- a/.github/workflows/publish-docker-latest.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -on: - release: - types: [released] - -name: Publish latest image to Docker Hub - -jobs: - docker-latest: - runs-on: docker - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - push: true - platforms: linux/amd64,linux/arm64 - tags: getmeili/meilisearch:latest diff --git a/.github/workflows/publish-docker-tag.yml b/.github/workflows/publish-docker.yml similarity index 67% rename from .github/workflows/publish-docker-tag.yml rename to .github/workflows/publish-docker.yml index eca3d1d25..2e2cd926d 100644 --- a/.github/workflows/publish-docker-tag.yml +++ b/.github/workflows/publish-docker.yml @@ -3,11 +3,13 @@ on: push: tags: - '*' + release: + types: [released] name: Publish tagged image to Docker Hub jobs: - docker-tag: + docker: runs-on: docker steps: - name: Set up QEMU @@ -27,8 +29,12 @@ jobs: uses: docker/metadata-action@v3 with: images: getmeili/meilisearch + # Output 'latest' tag only when 'release' happen, instead of when 'push tag' event happend (default behavior). + # See https://github.com/docker/metadata-action#latest-tag flavor: latest=false - tags: type=ref,event=tag + tags: | + type=ref,event=tag + type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'released' }} - name: Build and push id: docker_build