|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | + |
| 5 | +# Builds of tagged revisions are published to sonatype staging. |
| 6 | + |
| 7 | +# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. |
| 8 | +# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. |
| 9 | + |
| 10 | +# sbt-dynver sets the version number from the tag |
| 11 | +# sbt-travisci sets the Scala version from the travis job matrix |
| 12 | + |
| 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`) |
| 18 | + |
| 19 | +isReleaseJob() { |
| 20 | + if [[ "$ADOPTOPENJDK" == "8" ]]; then |
| 21 | + true |
| 22 | + else |
| 23 | + false |
| 24 | + fi |
| 25 | +} |
| 26 | + |
| 27 | +if [[ "$SCALAJS_VERSION" == "" ]]; then |
| 28 | + projectPrefix="" |
| 29 | +else |
| 30 | + projectPrefix="TODO/" |
| 31 | +fi |
| 32 | + |
| 33 | +verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" |
| 34 | +tagPat="^v$verPat(#.*)?$" |
| 35 | + |
| 36 | +if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then |
| 37 | + releaseTask="ci-release" |
| 38 | + if ! isReleaseJob; then |
| 39 | + echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" |
| 40 | + exit 0 |
| 41 | + fi |
| 42 | +fi |
| 43 | + |
| 44 | +# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions |
| 45 | +export CI_RELEASE="${projectPrefix}publishSigned" |
| 46 | +export CI_SNAPSHOT_RELEASE="${projectPrefix}publish" |
| 47 | + |
| 48 | +# default is sonatypeBundleRelease, which closes and releases the staging repo |
| 49 | +# see https://github.com/xerial/sbt-sonatype#commands |
| 50 | +# for now, until we're confident in the new release scripts, just close the staging repo. |
| 51 | +export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" |
| 52 | + |
| 53 | +sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $releaseTask |
0 commit comments