From 963db420feb63598d467ffb285bc60e9e5e438b0 Mon Sep 17 00:00:00 2001 From: ZdenekSrotyr <139972147+ZdenekSrotyr@users.noreply.github.com> Date: Wed, 22 Apr 2026 14:02:59 +0200 Subject: [PATCH] ci(release): push dev--latest alias for /* branches (#31) Adds a second tag to dev-channel image builds: when a branch is in the form /, the image is also pushed as ghcr.io/keboola/agnes-the-ai-analyst:dev--latest. Enables per-developer dev VMs on GRPN (and elsewhere) to auto-deploy without knowing the specific branch slug. Each VM pins its .env to AGNES_TAG=dev--latest, and the auto-upgrade cron (5 min tick) picks up the newly pushed image on the next run. Common Git Flow prefixes are deliberately skipped so feature/*, fix/*, hotfix/* etc. don't create noise tags. Matched list: feature, fix, hotfix, bugfix, docs, chore, test, ci, ops, refactor, perf, style, build. Verified locally against several branch names: zs/my-feature -> dev-zs-latest vr/foo -> dev-vr-latest pc/bar-baz -> dev-pc-latest feature/xyz -> (skipped) fix/bug -> (skipped) main -> (no-op, stable channel) test-no-slash -> (no-op, no slash) --- .github/workflows/release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d6e0b2c..86d636e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,6 +97,24 @@ jobs: 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}" + + # User prefix for / branches — powers the + # dev--latest alias tag so each developer's personal VM + # can pin to their prefix and auto-pull the latest push. Common + # Git Flow prefixes are skipped so `feature/x`, `fix/y` etc. + # don't create noisy -latest tags. + if [[ "$BRANCH_NAME" == *"/"* ]]; then + USER_PREFIX=$(echo "$BRANCH_NAME" | cut -d/ -f1 | sed 's|[^a-zA-Z0-9-]|-|g' | tr '[:upper:]' '[:lower:]') + case "$USER_PREFIX" in + feature|fix|hotfix|bugfix|docs|chore|test|ci|ops|refactor|perf|style|build) + echo "Branch prefix '$USER_PREFIX' is a Git Flow convention — skipping dev-*-latest alias" + ;; + *) + echo "user_prefix=${USER_PREFIX}" >> "$GITHUB_OUTPUT" + echo "User prefix: ${USER_PREFIX} (will push dev-${USER_PREFIX}-latest alias)" + ;; + esac + fi fi echo "Channel: ${CHANNEL}" @@ -123,6 +141,7 @@ jobs: 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) || '' }} + ${{ steps.meta.outputs.channel == 'dev' && steps.meta.outputs.user_prefix != '' && format('ghcr.io/{0}:dev-{1}-latest', github.repository, steps.meta.outputs.user_prefix) || '' }} smoke-test: needs: build-and-push