From cd717e580c407a1040e240c3f4bed86a32a43be4 Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 18 Oct 2021 14:43:37 +0200 Subject: [PATCH] ci: Tag docker image with tag name See https://github.com/tus/tusd/issues/511 --- .github/workflows/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3d8aca..9a6c395 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 +