Skip to content

Commit 7a17be1

Browse files
committed
release-version: check for newer parent versions
This is helpful to avoid releasing things built on too-old pom-scijava versions, which are less likely to melt correctly with everything else.
1 parent c440456 commit 7a17be1

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

release-version.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ Options include:
100100
--skip-gpg - Do not perform GPG signing of artifacts.
101101
"
102102

103+
# -- Extract project details --
104+
105+
projectDetails=$(mvn -N -Dexec.executable='echo' -Dexec.args='${project.version}::${project.parent.groupId}:${project.parent.artifactId}:${project.parent.version}' exec:exec -q)
106+
parentGAV=${projectDetails#*::}
107+
currentVersion=${projectDetails%::*}
108+
103109
# -- Sanity checks --
104110

105111
# Check that we have push rights to the repository.
@@ -111,7 +117,6 @@ then
111117
fi
112118

113119
# Discern the version to release.
114-
currentVersion=$(mvn -N -Dexec.executable='echo' -Dexec.args='${project.version}' exec:exec -q)
115120
pomVersion=${currentVersion%-SNAPSHOT}
116121
test "$VERSION" || test ! -t 0 || {
117122
printf 'Version? [%s]: ' "$pomVersion"
@@ -136,6 +141,17 @@ test "$SKIP_VERSION_CHECK" || {
136141
sh -$- "$VALID_SEMVER_BUMP" "$pomVersion" "$VERSION" || die
137142
}
138143

144+
# Check that the project extends the latest version of pom-scijava.
145+
MAVEN_HELPER="$(cd "$(dirname "$0")" && pwd)/maven-helper.sh"
146+
test -f "$MAVEN_HELPER" ||
147+
die "Missing helper script at '$MAVEN_HELPER'"
148+
test "$SKIP_VERSION_CHECKS" || {
149+
latestParentVersion=$(sh -$- "$MAVEN_HELPER" latest-version "$parentGAV")
150+
currentParentVersion=${parentGAV##*:}
151+
test "$currentParentVersion" = "$latestParentVersion" ||
152+
die "Newer version of parent '${parentGAV%:*}' is available: $latestParentVersion"
153+
}
154+
139155
# Check that the working copy is clean.
140156
no_changes_pending || die 'There are uncommitted changes!'
141157

0 commit comments

Comments
 (0)