Unverified Commit 04fd4432 authored by Cooper Lees's avatar Cooper Lees Committed by GitHub
Browse files

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
parent ad169642
Loading
Loading
Loading
Loading
+8 −1
Changes for .github/workflows/docker.yml: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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 }}