From cf89d1c4f56d9f05ae3ded8ce25d74e05eb40190 Mon Sep 17 00:00:00 2001 From: Cal Bera Date: Thu, 31 Jul 2025 08:58:50 -0700 Subject: [PATCH] chore(docker): improve workflow for version retrieval --- .github/workflows/docker.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f611d7b52a..3466a0acc3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -47,13 +47,19 @@ jobs: id: image_info run: | # Extract version information + VERSION="" if [[ "${{ github.ref }}" == refs/tags/* ]]; then - echo "VERSION=${{ github.ref_name }}" >> $GITHUB_OUTPUT + VERSION="${{ github.ref_name }}" elif [[ "${{ github.ref }}" == refs/heads/main ]]; then - echo "VERSION=latest" >> $GITHUB_OUTPUT - else - echo "VERSION=" >> $GITHUB_OUTPUT + VERSION="latest" fi + + if [ -z "$VERSION" ]; then + echo "Error: Could not determine version from ref '${{ github.ref }}'" + exit 1 + fi + + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT # Get the digest of the pushed image. The --format option can be unreliable, # so we parse the full JSON output to find the digest of the manifest list.