ci: Tag docker image with tag name
See
@@ -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
+
