Skip to content

Commit efc6b0e

Browse files
ibexa-yunaadamwojs
authored andcommitted
Update docker.yaml
1 parent 3fd8a49 commit efc6b0e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/docker.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,18 @@ jobs:
3434
- name: Extract version & image name
3535
id: vars
3636
run: |
37-
raw_tag=${GITHUB_REF#refs/tags/} # e.g. v1.4.0
38-
version=${raw_tag#v} # e.g. 1.4.0
37+
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
38+
raw_tag="${GITHUB_REF#refs/tags/}"
39+
version="${raw_tag#v}"
40+
else
41+
# ----- Branch / PR fallback -----
42+
branch="${GITHUB_REF#refs/heads/}"
43+
# Replace / and uppercase chars with safe lowercase dashes
44+
safe_branch=$(echo "$branch" | tr '[:upper:]/' '[:lower:]-')
45+
sha=${GITHUB_SHA::8}
46+
raw_tag="${safe_branch}-${sha}"
47+
version="$raw_tag"
48+
fi
3949
image_repo="ghcr.io/${GITHUB_REPOSITORY,,}"
4050
echo "raw_tag=$raw_tag" >> "$GITHUB_OUTPUT"
4151
echo "version=$version" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)