From 04fd4432f6c6007e419d7174930569a75ea60fed Mon Sep 17 00:00:00 2001 From: Cooper Lees Date: Tue, 27 Apr 2021 20:10:44 -0700 Subject: [PATCH] Add automatic version tagging to Docker CI Pushes (#2132) * Add automatic version tagging to Docker Uploads - If the git comment has a tag, set that on the docker images pushed - If we don't have a tag, we just set `latest_non_release` * Add trigger on release creation too * Make prettier happy omn docker.yml --- .github/workflows/docker.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0939013..7eaf233 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,6 +4,8 @@ on: push: branches: - "master" + release: + types: created jobs: docker: @@ -24,13 +26,18 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Check + set version tag + run: + echo "GIT_TAG=$(git describe --candidates=0 --tags 2> /dev/null || echo + latest_non_release)" >> $GITHUB_ENV + - name: Build and push uses: docker/build-push-action@v2 with: context: . platforms: linux/amd64,linux/arm64 push: true - tags: pyfound/black:latest + tags: pyfound/black:latest,pyfound/black:${{ env.GIT_TAG }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} -- 2.39.2