Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d2bea19

Browse files
committed
Allow building an existing tag against a new Scala version
For tags of the form `v1.2.3-suffix#2.13.0-M1`, the build script releases version `1.2.3-suffix` using Scala version `2.13.0-M1`. This allows building an existing tag against a new Scala version.
1 parent eb5bc9a commit d2bea19

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed

‎admin/README.md‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Tag Driven Releasing
22

3-
Copied from https://github.com/scala/scala-java8-compat/commit/4a6cfc97cd95227b86650410e1b632e5ff79335b.
4-
53
### Background Reading
64

75
- http://docs.travis-ci.com/user/environment-variables/
@@ -14,12 +12,12 @@ To configure tag driven releases from Travis CI.
1412

1513
1. Generate a key pair for this repository with `./admin/genKeyPair.sh`.
1614
Edit `.travis.yml` and `admin/build.sh` as prompted.
17-
2. Publish the public key to https://pgp.mit.edu
18-
3. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`.
15+
1. Publish the public key to https://pgp.mit.edu
16+
1. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`.
1917
Edit `.travis.yml` as prompted.
20-
4. Edit `.travis.yml` to use `./admin/build.sh` as the build script,
18+
1. Edit `.travis.yml` to use `./admin/build.sh` as the build script,
2119
and edit that script to use the tasks required for this project.
22-
5. Edit `build.sbt` to select which JDK will be used for publishing.
20+
1. Edit `build.sbt` to select which JDK will be used for publishing.
2321

2422
It is important to add comments in .travis.yml to identify the name
2523
of each environment variable encoded in a `:secure` section.
@@ -45,16 +43,18 @@ Be sure to use SBT 0.13.7 or higher to avoid [#1430](https://github.com/sbt/sbt/
4543

4644
### Testing
4745

48-
1. Follow the release process below to create a dummy release (e.g. 0.1.0-TEST1).
46+
1. Follow the release process below to create a dummy release (e.g., `v0.1.0-TEST1`).
4947
Confirm that the release was staged to Sonatype but do not release it to Maven
5048
central. Instead, drop the staging repository.
5149

5250
### Performing a release
5351

54-
1. Create a GitHub "Release" (with a corresponding tag) via the GitHub
52+
1. Create a GitHub "Release" with a corresponding tag (e.g., `v0.1.1`) via the GitHub
5553
web interface.
56-
2. Travis CI will schedule a build for this release. Review the build logs.
57-
3. Log into https://oss.sonatype.org/ and identify the staging repository.
58-
4. Sanity check its contents
59-
5. Release staging repository to Maven and send out release announcement.
60-
54+
1. The release will be published using all Scala versions in `build.sbt`'s `crossScalaVersions`.
55+
If you need to release it against a different Scala version, include it in the tag
56+
name after a `#` (e.g., `v0.1.1#2.13.0-M1`).
57+
1. Travis CI will schedule a build for this release. Review the build logs.
58+
1. Log into https://oss.sonatype.org/ and identify the staging repository.
59+
1. Sanity check its contents.
60+
1. Release staging repository to Maven and send out release announcement.

‎admin/build.sh‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,33 @@
22

33
set -e
44

5-
# prep environment for publish to sonatype staging if the HEAD commit is tagged
5+
# Builds of tagged revisions are published to sonatype staging.
66

7-
# git on travis does not fetch tags, but we have TRAVIS_TAG
8-
# headTag=$(git describe --exact-match ||:)
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+
# Checking the local git clone would not work because git on travis does not fetch tags.
910

10-
if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then
11+
# The version number to be published is extracted from the tag, e.g., v1.2.3 publishes
12+
# version 1.2.3 using all Scala versions in build.sbt's `crossScalaVersions`.
13+
14+
# When a new, binary incompatible Scala version becomes available, a previously released version
15+
# can be released using that new Scala version by creating a new tag containing the Scala version
16+
# after a hash, e.g., v1.2.3#2.13.0-M1.
17+
18+
verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?"
19+
tagPat="^v$verPat(#$verPat)?$"
20+
21+
if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
1122
echo "Going to release from tag $TRAVIS_TAG!"
12-
myVer=$(echo $TRAVIS_TAG | sed -e s/^v//)
13-
publishVersion='set every version := "'$myVer'"'
23+
24+
tagVer=$(echo $TRAVIS_TAG | sed s/#.*// | sed s/^v//)
25+
publishVersion='set every version := "'$tagVer'"'
26+
27+
scalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//)
28+
if [ "$scalaVer" != "" ]; then
29+
publishScalaVersion='set every crossScalaVersions := Seq("'$scalaVer'")'
30+
fi
31+
1432
extraTarget="+publish-signed"
1533
cat admin/gpg.sbt >> project/plugins.sbt
1634
cp admin/publish-settings.sbt .
@@ -22,4 +40,4 @@ if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then
2240
openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d
2341
fi
2442
25-
sbt "$publishVersion" clean update +test +publishLocal $extraTarget
43+
sbt "$publishVersion" "$publishScalaVersion"clean update +test +publishLocal $extraTarget

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /