ci: also tag image with semver on v* git tags
Build & Push Docker Image / build (push) Successful in 2m28s
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:
@@ -30,13 +30,16 @@ jobs:
|
||||
FULL_SHA=$(git rev-parse HEAD)
|
||||
IMAGE="git.kubebase.de/${{ gitea.repository }}"
|
||||
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 \
|
||||
--build-arg COMMIT_SHA="$FULL_SHA" \
|
||||
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
|
||||
--build-arg VERSION="$VERSION" \
|
||||
-t "${IMAGE}:sha-${SHA}" -t "${IMAGE}:latest" .
|
||||
$TAGS .
|
||||
docker push "${IMAGE}:sha-${SHA}"
|
||||
docker push "${IMAGE}:latest"
|
||||
if [ -n "$VERSION" ]; then docker push "${IMAGE}:${VERSION}"; fi
|
||||
|
||||
- name: Update k8s manifest in admin/apps
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user