ci: also tag image with semver on v* git tags
Build & Push Docker Image / build (push) Successful in 2m28s

On tag push (vX.Y.Z) the image is additionally pushed as IMAGE:vX.Y.Z;
sha-... and latest tags stay as-is and the k8s manifest keeps using sha-...
This commit is contained in:
opencode
2026-08-02 02:21:41 +02:00
parent 803802a5b6
commit bcc74328d6
+4 -1
View File
@@ -30,13 +30,16 @@ jobs:
FULL_SHA=$(git rev-parse HEAD) FULL_SHA=$(git rev-parse HEAD)
IMAGE="git.kubebase.de/${{ gitea.repository }}" IMAGE="git.kubebase.de/${{ gitea.repository }}"
if [ "${{ gitea.ref_type }}" = "tag" ]; then VERSION="${{ gitea.ref_name }}"; else VERSION=""; fi if [ "${{ gitea.ref_type }}" = "tag" ]; then VERSION="${{ gitea.ref_name }}"; else VERSION=""; fi
TAGS="-t ${IMAGE}:sha-${SHA} -t ${IMAGE}:latest"
if [ -n "$VERSION" ]; then TAGS="${TAGS} -t ${IMAGE}:${VERSION}"; fi
docker build --no-cache \ docker build --no-cache \
--build-arg COMMIT_SHA="$FULL_SHA" \ --build-arg COMMIT_SHA="$FULL_SHA" \
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--build-arg VERSION="$VERSION" \ --build-arg VERSION="$VERSION" \
-t "${IMAGE}:sha-${SHA}" -t "${IMAGE}:latest" . $TAGS .
docker push "${IMAGE}:sha-${SHA}" docker push "${IMAGE}:sha-${SHA}"
docker push "${IMAGE}:latest" docker push "${IMAGE}:latest"
if [ -n "$VERSION" ]; then docker push "${IMAGE}:${VERSION}"; fi
- name: Update k8s manifest in admin/apps - name: Update k8s manifest in admin/apps
env: env: