ci: Tag docker image with tag name

See https://github.com/tus/tusd/issues/511
This commit is contained in:
Marius 2021-10-18 14:43:37 +02:00 committed by GitHub
parent 84faa14987
commit cd717e580c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -59,3 +59,18 @@ jobs:
run: |
docker build -t tusproject/tusd:$GITHUB_SHA .
docker push tusproject/tusd:$GITHUB_SHA
- name: Tag docker image with release tag
if: startsWith(github.ref, 'refs/tags/')
run: |
# Extract tag name: https://stackoverflow.com/a/58178121
TAG_NAME="${GITHUB_REF#refs/*/}"
docker tag tusproject/tusd:$GITHUB_SHA tusproject/tusd:$TAG_NAME
docker push tusproject/tusd:$TAG_NAME
# Create latest tag if we have no pre-release
if [[ $TAG_NAME =~ ^v\d+\.\d+\.\d+$ ]];
then
docker tag tusproject/tusd:$GITHUB_SHA tusproject/tusd:latest
docker push tusproject/tusd:latest
fi
shell: bash