This is an automated email from the ASF dual-hosted git repository.

hgruszecki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new 800fcf92e feat(ci): add versioned edge Docker tags in post-merge 
workflow (#2528)
800fcf92e is described below

commit 800fcf92e674422ef961421b6ed19ad986db096c
Author: Hubert Gruszecki <[email protected]>
AuthorDate: Fri Jan 2 10:42:19 2026 +0100

    feat(ci): add versioned edge Docker tags in post-merge workflow (#2528)
    
    Add automatic versioned Docker tag publishing (e.g., `0.6.1-edge.2`)
    alongside the rolling `edge` tag, mirroring the Rust crates auto-publish
    pattern.
    
    Co-authored-by: Piotr Gankiewicz <[email protected]>
---
 .github/workflows/post-merge.yml | 143 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 137 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml
index 9d38472e7..e6eb4a9a1 100644
--- a/.github/workflows/post-merge.yml
+++ b/.github/workflows/post-merge.yml
@@ -111,6 +111,14 @@ jobs:
     steps:
       - uses: actions/checkout@v4
 
+      - name: Extract version
+        id: ver
+        run: |
+          chmod +x scripts/extract-version.sh
+          VERSION=$(scripts/extract-version.sh "${{ matrix.component }}")
+          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+          echo "✅ Resolved ${{ matrix.component }} -> version=$VERSION"
+
       - name: Determine libc for component
         id: libc
         run: |
@@ -127,7 +135,7 @@ jobs:
           task: publish
           libc: ${{ steps.libc.outputs.libc }}
           component: ${{ matrix.component }}
-          version: edge
+          version: ${{ steps.ver.outputs.version }}
           platform: ${{ matrix.platform }}
           dry_run: ${{ github.event.repository.fork }}
 
@@ -156,7 +164,7 @@ jobs:
 
   docker-manifests:
     name: Create manifests
-    needs: [plan, docker-edge]
+    needs: [plan, docker-edge, check-docker-auto-publish]
     if: ${{ !github.event.repository.fork && 
fromJson(needs.plan.outputs.components).include[0].component != 'noop' }}
     runs-on: ubuntu-latest
     strategy:
@@ -204,25 +212,77 @@ jobs:
           username: ${{ env.DOCKERHUB_USER }}
           password: ${{ env.DOCKERHUB_TOKEN }}
 
+      - name: Extract version
+        id: ver
+        run: |
+          chmod +x scripts/extract-version.sh
+          VERSION=$(scripts/extract-version.sh "${{ matrix.component }}")
+          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+
       - name: Create and push manifest
         working-directory: ${{ runner.temp }}/digests
+        env:
+          COMPONENTS_TO_PUBLISH: ${{ 
needs.check-docker-auto-publish.outputs.components_to_publish }}
         run: |
           IMAGE="${{ steps.config.outputs.image }}"
-          VERSION="edge"
+          COMPONENT="${{ matrix.component }}"
+          VERSION="${{ steps.ver.outputs.version }}"
 
-          echo "Creating manifest for $IMAGE:$VERSION from digests:"
+          echo "Creating manifests for $IMAGE from digests:"
           ls -la
 
+          # Always create the rolling 'edge' tag
           docker buildx imagetools create \
-            -t "${IMAGE}:${VERSION}" \
+            -t "${IMAGE}:edge" \
             $(printf "${IMAGE}@sha256:%s " *)
 
-          echo "✅ Pushed manifest: ${IMAGE}:${VERSION}"
+          echo "✅ Pushed manifest: ${IMAGE}:edge"
+
+          # Also create versioned tag if this component needs it
+          if echo "$COMPONENTS_TO_PUBLISH" | grep -qE 
"(^|,)${COMPONENT}(,|$)"; then
+            echo "Creating versioned manifest for $IMAGE:$VERSION"
+            docker buildx imagetools create \
+              -t "${IMAGE}:${VERSION}" \
+              $(printf "${IMAGE}@sha256:%s " *)
+
+            echo "✅ Pushed manifest: ${IMAGE}:${VERSION}"
+          fi
 
       - name: Inspect manifest
         run: |
           docker buildx imagetools inspect "${{ steps.config.outputs.image 
}}:edge"
 
+  # Create git tags for Docker images with versioned edge/rc releases
+  create-docker-tags:
+    name: Create Docker git tags
+    runs-on: ubuntu-latest
+    needs: [docker-manifests, check-docker-auto-publish]
+    if: needs.check-docker-auto-publish.outputs.should_publish == 'true'
+    permissions:
+      contents: write
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - name: Create git tags
+        env:
+          COMPONENTS_TO_PUBLISH: ${{ 
needs.check-docker-auto-publish.outputs.components_to_publish }}
+        run: |
+          chmod +x scripts/extract-version.sh
+
+          for component in $(echo "$COMPONENTS_TO_PUBLISH" | tr ',' ' '); do
+            TAG=$(scripts/extract-version.sh "$component" --tag)
+
+            if ! git rev-parse "$TAG" >/dev/null 2>&1; then
+              git tag -a "$TAG" -m "Release $TAG"
+              git push origin "$TAG"
+              echo "✅ Created tag: $TAG"
+            else
+              echo "⏭️ Tag $TAG already exists"
+            fi
+          done
+
   build-artifacts:
     name: Build artifacts
     uses: ./.github/workflows/_build_rust_artifacts.yml
@@ -310,6 +370,77 @@ jobs:
 
             **Not an official ASF release** - for development/testing only.
 
+  # Check if auto-publish should run for Docker edge/rc versions
+  check-docker-auto-publish:
+    name: Check Docker auto-publish
+    runs-on: ubuntu-latest
+    if: ${{ !github.event.repository.fork }}
+    outputs:
+      should_publish: ${{ steps.check.outputs.should_publish }}
+      components_to_publish: ${{ steps.check.outputs.components_to_publish }}
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - name: Setup yq
+        run: |
+          if ! command -v yq >/dev/null 2>&1; then
+            YQ_VERSION="v4.47.1"
+            
YQ_CHECKSUM="0fb28c6680193c41b364193d0c0fc4a03177aecde51cfc04d506b1517158c2fb"
+            curl -sSL -o /usr/local/bin/yq 
https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64
+            echo "${YQ_CHECKSUM}  /usr/local/bin/yq" | sha256sum -c - || exit 1
+            chmod +x /usr/local/bin/yq
+          fi
+
+      - name: Check versions and tags for Docker components
+        id: check
+        run: |
+          chmod +x scripts/extract-version.sh
+
+          # Get Docker components from config (same source as plan job)
+          DOCKER_COMPONENTS=$(yq -r '.components | to_entries | .[] | 
select(.value.registry == "dockerhub") | .key' .github/config/publish.yml)
+
+          COMPONENTS_TO_PUBLISH=""
+
+          for component in $DOCKER_COMPONENTS; do
+            VERSION=$(scripts/extract-version.sh "$component")
+            TAG=$(scripts/extract-version.sh "$component" --tag)
+
+            echo "Checking $component: version=$VERSION, tag=$TAG"
+
+            # Skip if version doesn't contain edge or rc
+            if [[ ! "$VERSION" =~ -(edge|rc) ]]; then
+              echo "  ⏭️ Stable version - skipping"
+              continue
+            fi
+
+            # Skip if git tag already exists
+            if git rev-parse "$TAG" >/dev/null 2>&1; then
+              echo "  ⏭️ Tag exists - skipping"
+              continue
+            fi
+
+            echo "  ✅ Will publish versioned tag"
+            if [ -n "$COMPONENTS_TO_PUBLISH" ]; then
+              COMPONENTS_TO_PUBLISH="$COMPONENTS_TO_PUBLISH,$component"
+            else
+              COMPONENTS_TO_PUBLISH="$component"
+            fi
+          done
+
+          if [ -z "$COMPONENTS_TO_PUBLISH" ]; then
+            echo ""
+            echo "No Docker components need versioned publishing"
+            echo "should_publish=false" >> "$GITHUB_OUTPUT"
+            echo "components_to_publish=" >> "$GITHUB_OUTPUT"
+          else
+            echo ""
+            echo "Components to publish: $COMPONENTS_TO_PUBLISH"
+            echo "should_publish=true" >> "$GITHUB_OUTPUT"
+            echo "components_to_publish=$COMPONENTS_TO_PUBLISH" >> 
"$GITHUB_OUTPUT"
+          fi
+
   # Check if auto-publish should run for edge/rc versions
   check-auto-publish:
     name: Check auto-publish

Reply via email to