From 679049e7fc6329a7fcc14f0c35dde2c2e9bf90db Mon Sep 17 00:00:00 2001 From: Friedrich von Never Date: Sun, 20 Oct 2024 13:55:10 +0200 Subject: [PATCH] CI: update to the latest Docker actions --- .github/workflows/docker.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index aa7d202..a935f0a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,12 +18,25 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Build and Push Docker Images - uses: docker/build-push-action@v6 + - name: Extract metadata for Docker + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + id: meta + uses: docker/metadata-action@v5 + with: + images: codingteam/codingteam.org.ru + tags: type=ref,event=branch + + - name: Login to Docker Hub + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - repository: codingteam/codingteam.org.ru - tag_with_ref: true - tags: latest + + - name: Build and Push Docker Images + uses: docker/build-push-action@v6 + with: + tags: | + ${{ steps.meta.outputs.tags }} + codingteam/codingteam.org.ru:latest push: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') && 'true' || 'false' }}