Skip to content

Commit cbf53e8

Browse files
authored
Fix bug in publishing :latest tag to Docker Hub (#45)
There were two issues tied together here: - The regex was failing because the version of `grep` on Circle needs the `-P` option for our expression. - The regex fails (intentionally) for pre-release tags, but that was causing the step to fail, rather than switch branches and log that there was nothing to publish.
1 parent 3c6e332 commit cbf53e8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.circleci/config.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ jobs:
100100
name: Publish :latest Tag If Final Release
101101
command: |
102102
# Skip tags with additional info after "v0.0.0", e.g. "v1.0.0a1"
103-
FINAL_VERSION="$(echo "${CIRCLE_TAG}" | grep -E '^v\d+(\.\d+)+$')"
103+
# NOTE: the version of grep on Circle needs -P (perl-style regex)
104+
# instead of -E (extended regex) to support `\d`.
105+
FINAL_VERSION="$(
106+
echo "${CIRCLE_TAG}" |
107+
grep -P '^v\d+(\.\d+)+$' ||
108+
true
109+
)"
104110
if [ -z "${FINAL_VERSION}" ]; then
105111
echo 'The current tag does not represent a final release!'
106112
echo 'Not publishing a ":latest" tag.'

0 commit comments

Comments
 (0)