From 5188bd9127e841fae9d3d8b773d78411c296ff13 Mon Sep 17 00:00:00 2001 From: ZdenekSrotyr Date: Tue, 21 Apr 2026 15:31:24 +0200 Subject: [PATCH] ci: add per-branch image tag :dev- for branch-aware dev deploys Extracts branch name from GITHUB_REF, slugifies it, and adds as extra tag on feature branch builds. Main branch is unaffected (no branch_slug output). Enables dev_instances tfvar with image_tag pinning specific feature branches. --- .github/workflows/release.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e2c6a2..6b1bfb5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,6 +89,14 @@ jobs: echo "versioned_tag=${TAG}" >> "$GITHUB_OUTPUT" echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT" + # Per-branch slug for dev builds (enables branch-aware dev VMs) + if [[ "${{ github.ref }}" != "refs/heads/main" ]]; then + BRANCH_NAME="${GITHUB_REF#refs/heads/}" + BRANCH_SLUG=$(echo "$BRANCH_NAME" | sed 's|^feature/||' | sed 's|[^a-zA-Z0-9-]|-|g' | tr '[:upper:]' '[:lower:]' | cut -c1-50) + echo "branch_slug=${BRANCH_SLUG}" >> "$GITHUB_OUTPUT" + echo "Branch slug: ${BRANCH_SLUG}" + fi + echo "Channel: ${CHANNEL}" echo "Version: ${VERSION}" echo "Versioned tag: ${TAG}" @@ -111,6 +119,7 @@ jobs: ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.channel }} ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.versioned_tag }} ghcr.io/${{ github.repository }}:sha-${{ steps.meta.outputs.short_sha }} + ${{ steps.meta.outputs.channel == 'dev' && format('ghcr.io/{0}:dev-{1}', github.repository, steps.meta.outputs.branch_slug) || '' }} smoke-test: needs: build-and-push