Skip to content

Commit ae6da57

Browse files
authored
Merge pull request #131 from SethTisue/modernize-publishing
bring build.sh in line with latest design
2 parents 044ae4c + 7f4985c commit ae6da57

File tree

1 file changed

+15
-30
lines changed

1 file changed

+15
-30
lines changed

build.sh

+15-30
Original file line numberDiff line numberDiff line change
@@ -10,56 +10,41 @@ set -e
1010
# sbt-dynver sets the version number from the tag
1111
# sbt-travisci sets the Scala version from the travis job matrix
1212

13-
# When a new binary incompatible Scala version becomes available, a previously released version
14-
# can be released using that new Scala version by creating a new tag containing the Scala version
15-
# after a hash, e.g., v1.2.3#2.13.0-M3.
13+
# To back-publish an existing release for a new Scala / Scala.js / Scala Native version:
14+
# - check out the tag for the version that needs to be published
15+
# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary
16+
# - 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`)
1618

17-
# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x
19+
# We release on JDK 8 (for Scala 2.x and 3.x).
1820
isReleaseJob() {
19-
if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[34]\..*$ ]]; then
21+
if [[ "$ADOPTOPENJDK" == "8" ]]; then
2022
true
2123
else
2224
false
2325
fi
2426
}
2527

26-
# For tags that define a Scala version, we pick the jobs of one Scala version (2.13.x) to do the releases
27-
isTagScalaReleaseJob() {
28-
if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then
29-
true
30-
else
31-
false
32-
fi
33-
}
28+
projectPrefix=""
3429

3530
verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?"
36-
tagPat="^v$verPat(#$verPat)?$"
31+
tagPat="^v$verPat(#.*)?$"
3732

3833
if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
3934
releaseTask="ci-release"
40-
tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//)
41-
if [[ "$tagScalaVer" == "" ]]; then
42-
if ! isReleaseJob; then
43-
echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION"
44-
exit 0
45-
fi
46-
else
47-
if isTagScalaReleaseJob; then
48-
setTagScalaVersion='set every scalaVersion := "'$tagScalaVer'"'
49-
else
50-
echo "The releases for Scala $tagScalaVer are built by other jobs in the travis job matrix"
51-
exit 0
52-
fi
35+
if ! isReleaseJob; then
36+
echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION"
37+
exit 0
5338
fi
5439
fi
5540

5641
# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions
57-
export CI_RELEASE="publishSigned"
58-
export CI_SNAPSHOT_RELEASE="publish"
42+
export CI_RELEASE="${projectPrefix}publishSigned"
43+
export CI_SNAPSHOT_RELEASE="${projectPrefix}publish"
5944

6045
# default is sonatypeBundleRelease, which closes and releases the staging repo
6146
# see https://github.com/xerial/sbt-sonatype#commands
6247
# for now, until we're confident in the new release scripts, just close the staging repo.
6348
export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose"
6449

65-
sbt "$setTagScalaVersion" clean test core/headerCheck publishLocal $releaseTask
50+
sbt clean ${projectPrefix}test core/headerCheck ${projectPrefix}publishLocal $releaseTask

0 commit comments

Comments
 (0)