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:
parent
ad1696422b
commit
04fd4432f6
9
.github/workflows/docker.yml
vendored
9
.github/workflows/docker.yml
vendored
@ -4,6 +4,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "master"
|
||||||
|
release:
|
||||||
|
types: created
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@ -24,13 +26,18 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
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
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: pyfound/black:latest
|
tags: pyfound/black:latest,pyfound/black:${{ env.GIT_TAG }}
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
Loading…
Reference in New Issue
Block a user