Skip to content

Commit

Permalink
Sanitize version/ref_name for use as docker label
Browse files Browse the repository at this point in the history
Docker labels/tags can contain only alphanumeric chars, underscores,
periods and hyphens and must start with alphanumeric or underscores. So
we convert all invalid chars to hyphens and strip leading invalid chars.
Also collapse runs of hyphens to a single hyphen.

Technically we do not need to strip the leading chars as we construct
the label with the version as a suffix, but it would look a little weird
if we didn't and allows us to use the version as a pure tag if we want
to later.
  • Loading branch information
camscale committed Nov 28, 2023
1 parent f5f78b3 commit 4dbb647
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
echo "No version or ref_name set" >&2
exit 1
fi
V="$(echo "$V" | sed -e 's/[^A-Za-z0-9_.-]/-/g' -e 's/--*/-/g' -e 's/^[^A-Za-z0-9_]*//')"
echo "V=$V" >> "$GITHUB_ENV"
- name: Assume AWS ECR Push Role
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
Expand Down

0 comments on commit 4dbb647

Please sign in to comment.