Skip to content

Commit 97165a3

Browse files
authored
CSHARP-5491: Validate API Compatibility against previous minor release (#1612)
1 parent d49098d commit 97165a3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

evergreen/validate-apicompat.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@ if [ -z "$PACKAGE_VERSION" ]; then
99
echo Calculated PACKAGE_VERSION value: "$PACKAGE_VERSION"
1010
fi
1111

12-
BASELINE_VERSION="${PACKAGE_VERSION%%.*}.0.0"
12+
if [[ $PACKAGE_VERSION == *"-"* ]]; then
13+
# PACKAGE_VERSION contains "-" (M.m.p-1-ab1cdce23456) - we are doing build of intermediate package, to calculate the baseline version need to simply cut on first "-"
14+
BASELINE_VERSION="${PACKAGE_VERSION%%-*}"
15+
else
16+
# PACKAGE_VERSION is "clear" version (M.m.p) - baseline version should be set to the previous minor version.
17+
VERSION_COMPONENTS=( ${PACKAGE_VERSION//./ } )
18+
if [[ VERSION_COMPONENTS[1] -gt 0 ]]; then
19+
((VERSION_COMPONENTS[1]--))
20+
fi
21+
22+
BASELINE_VERSION="${VERSION_COMPONENTS[0]}.${VERSION_COMPONENTS[1]}.0"
23+
fi
24+
1325
if [ "$PACKAGE_VERSION" == "$BASELINE_VERSION" ]; then
1426
echo "Skipping package validation for major release."
1527
exit 0

0 commit comments

Comments
 (0)