Skip to content

Commit e6e52bc

Browse files
feat(tag.sh): Improved resiliency of the release process (#3530)
1 parent 113a18a commit e6e52bc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/tag.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ then
4949
exit 1
5050
fi
5151

52+
GOMOD_ERRORS=0
53+
54+
# Check go.mod files for correct dependency versions
55+
while read -r mod_file; do
56+
# Look for go-redis packages in require statements
57+
while read -r pkg version; do
58+
if [ "$version" != "${TAG}" ]; then
59+
printf "Error: %s has incorrect version for package %s: %s (expected %s)\n" "$mod_file" "$pkg" "$version" "${TAG}"
60+
GOMOD_ERRORS=$((GOMOD_ERRORS + 1))
61+
fi
62+
done < <(awk '/^require|^require \(/{p=1;next} /^\)/{p=0} p{if($1 ~ /^github\.com\/redis\/go-redis/){print $1, $2}}' "$mod_file")
63+
done < <(find . -type f -name 'go.mod')
64+
65+
# Exit if there are gomod errors
66+
if [ $GOMOD_ERRORS -gt 0 ]; then
67+
exit 1
68+
fi
69+
70+
5271
PACKAGE_DIRS=$(find . -mindepth 2 -type f -name 'go.mod' -exec dirname {} \; \
5372
| grep -E -v "example|internal" \
5473
| sed 's/^\.\///' \

0 commit comments

Comments
 (0)