ci: auto-version every push as dev-DATE with nightly-DATE image tag
Build & Push Docker Image / build (push) Successful in 2m20s
Build & Push Docker Image / build (push) Successful in 2m20s
Push builds now bake VERSION=dev-YYYYMMDD and additionally tag the image nightly-YYYYMMDD, so a dated, identifiable artifact exists without creating a git tag. Explicit v* tags keep tagging IMAGE:vX.Y.Z.
This commit is contained in:
@@ -29,9 +29,15 @@ jobs:
|
||||
SHA=$(git rev-parse --short HEAD)
|
||||
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
|
||||
DATE_STAMP=$(date -u +"%Y%m%d")
|
||||
if [ "${{ gitea.ref_type }}" = "tag" ]; then
|
||||
VERSION="${{ gitea.ref_name }}"
|
||||
VERSION_TAG="${{ gitea.ref_name }}"
|
||||
else
|
||||
VERSION="dev-${DATE_STAMP}"
|
||||
VERSION_TAG="nightly-${DATE_STAMP}"
|
||||
fi
|
||||
TAGS="-t ${IMAGE}:sha-${SHA} -t ${IMAGE}:latest -t ${IMAGE}:${VERSION_TAG}"
|
||||
docker build --no-cache \
|
||||
--build-arg COMMIT_SHA="$FULL_SHA" \
|
||||
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
|
||||
@@ -39,7 +45,7 @@ jobs:
|
||||
$TAGS .
|
||||
docker push "${IMAGE}:sha-${SHA}"
|
||||
docker push "${IMAGE}:latest"
|
||||
if [ -n "$VERSION" ]; then docker push "${IMAGE}:${VERSION}"; fi
|
||||
docker push "${IMAGE}:${VERSION_TAG}"
|
||||
|
||||
- name: Update k8s manifest in admin/apps
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user