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
This commit is contained in:
Cooper Lees 2021-04-27 20:10:44 -07:00 committed by GitHub
parent ad1696422b
commit 04fd4432f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 }}