We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fd8a49 commit efc6b0eCopy full SHA for efc6b0e
.github/workflows/docker.yaml
@@ -34,8 +34,18 @@ jobs:
34
- name: Extract version & image name
35
id: vars
36
run: |
37
- raw_tag=${GITHUB_REF#refs/tags/} # e.g. v1.4.0
38
- version=${raw_tag#v} # e.g. 1.4.0
+ if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
+ 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
49
image_repo="ghcr.io/${GITHUB_REPOSITORY,,}"
50
echo "raw_tag=$raw_tag" >> "$GITHUB_OUTPUT"
51
echo "version=$version" >> "$GITHUB_OUTPUT"
0 commit comments