Skip to content

Commit d21091b

Browse files
committed
build.sh: try to support # tags for single Scala version releases again
1 parent e03008b commit d21091b

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

build.sh

+25-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set -e
1414
# - check out the tag for the version that needs to be published
1515
# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary
1616
# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g.,
17-
# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`)
17+
# `v1.2.3#3.0.0-M2` (the suffix is ignored, the version will be `1.2.3`)
1818

1919
# We release on JDK 8 (for Scala 2.x and 3.x)
2020
isReleaseJob() {
@@ -25,20 +25,39 @@ isReleaseJob() {
2525
fi
2626
}
2727

28+
# For tags that define a Scala version, we pick the jobs of one Scala version (2.13.x) to do the releases
29+
isTagScalaReleaseJob() {
30+
if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then
31+
true
32+
else
33+
false
34+
fi
35+
}
36+
2837
if [[ "$SCALAJS_VERSION" == "" ]]; then
2938
projectPrefix="swing/"
3039
else
3140
projectPrefix="swingJS/"
3241
fi
3342

3443
verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?"
35-
tagPat="^v$verPat(#.*)?$"
44+
tagPat="^v$verPat(#$verPat)?$"
3645

3746
if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
3847
releaseTask="ci-release"
39-
if ! isReleaseJob; then
40-
echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION"
41-
exit 0
48+
tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//)
49+
if [[ "$tagScalaVer" == "" ]]; then
50+
if ! isReleaseJob; then
51+
echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION"
52+
exit 0
53+
fi
54+
else
55+
if isTagScalaReleaseJob; then
56+
setTagScalaVersion='set every scalaVersion := "'$tagScalaVer'"'
57+
else
58+
echo "The releases for Scala $tagScalaVer are built by other jobs in the travis job matrix"
59+
exit 0
60+
fi
4261
fi
4362
fi
4463
@@ -51,4 +70,4 @@ export CI_SNAPSHOT_RELEASE="${projectPrefix}publish"
5170
# for now, until we're confident in the new release scripts, just close the staging repo.
5271
export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose"
5372
54-
sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $releaseTask
73+
sbt "$setTagScalaVersion" clean ${projectPrefix}test ${projectPrefix}publishLocal $releaseTask

0 commit comments

Comments
 (0)