-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starts the effort to simplify artifact release (#995)
* starts the effort to simplify artifact release * lint fix * hardcoded name and email
- Loading branch information
1 parent
3079e72
commit e951831
Showing
4 changed files
with
93 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import microsites.ExtraMdFileConfig | ||
import sbtrelease.ReleasePlugin | ||
import ReleaseTransformations._ | ||
|
||
lazy val buildSettings = Seq( | ||
organization := "com.github.finagle", | ||
version := "0.24.0", | ||
scalaVersion := "2.12.7", | ||
crossScalaVersions := Seq("2.11.12", "2.12.7") | ||
) | ||
|
@@ -64,6 +65,33 @@ val baseSettings = Seq( | |
javaOptions in ThisBuild ++= Seq("-Xss2048K") | ||
) | ||
|
||
def updateVersionInFile(selectVersion: sbtrelease.Versions => String): ReleaseStep = | ||
ReleaseStep(action = st => { | ||
val newVersion = selectVersion(st.get(ReleaseKeys.versions).get) | ||
import scala.io.Source | ||
import java.io.PrintWriter | ||
|
||
// files containing version to update upon release | ||
val filesToUpdate = Seq( | ||
"docs/src/main/tut/index.md" | ||
) | ||
val pattern = """"com.github.finagle" %% "finch-.*" % "(.*)"""".r | ||
|
||
filesToUpdate.foreach { fileName => | ||
val content = Source.fromFile(fileName).getLines.mkString("\n") | ||
val newContent = | ||
pattern.replaceAllIn(content, | ||
m => m.matched.replaceAllLiterally(m.subgroups.head, newVersion)) | ||
new PrintWriter(fileName) { | ||
write(newContent); close() | ||
} | ||
val vcs = Project.extract(st).get(releaseVcs).get | ||
vcs.add(fileName).! | ||
} | ||
|
||
st | ||
}) | ||
|
||
lazy val publishSettings = Seq( | ||
publishMavenStyle := true, | ||
publishArtifact := true, | ||
|
@@ -75,6 +103,10 @@ lazy val publishSettings = Seq( | |
Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
}, | ||
publishArtifact in Test := false, | ||
pgpSecretRing := file("local.secring.gpg"), | ||
pgpPublicRing := file("local.pubring.gpg"), | ||
releasePublishArtifactsAction := PgpKeys.publishSigned.value, | ||
releaseIgnoreUntrackedFiles := true, | ||
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), | ||
homepage := Some(url("https://github.com/finagle/finch")), | ||
autoAPIMappings := true, | ||
|
@@ -85,6 +117,23 @@ lazy val publishSettings = Seq( | |
"scm:git:[email protected]:finagle/finch.git" | ||
) | ||
), | ||
releaseProcess := { | ||
Seq[ReleaseStep]( | ||
checkSnapshotDependencies, | ||
inquireVersions, | ||
releaseStepCommandAndRemaining("+clean"), | ||
releaseStepCommandAndRemaining("+test"), | ||
setReleaseVersion, | ||
updateVersionInFile(_._1), | ||
commitReleaseVersion, | ||
tagRelease, | ||
releaseStepCommandAndRemaining("+publishSigned"), | ||
setNextVersion, | ||
commitNextVersion, | ||
releaseStepCommand("sonatypeReleaseAll"), | ||
pushChanges | ||
) | ||
}, | ||
pomExtra := | ||
<developers> | ||
<developer> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
SBT_CMD="sbt ++${TRAVIS_SCALA_VERSION} validate" | ||
|
||
if [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then | ||
SBT_CMD+=" +coverageOff +publish" | ||
openssl aes-256-cbc -pass env:ENCRYPTION_PASSWORD -in ./build/secring.gpg.enc -out local.secring.gpg -d | ||
openssl aes-256-cbc -pass env:ENCRYPTION_PASSWORD -in ./build/pubring.gpg.enc -out local.pubring.gpg -d | ||
openssl aes-256-cbc -pass env:ENCRYPTION_PASSWORD -in ./build/credentials.sbt.enc -out local.credentials.sbt -d | ||
openssl aes-256-cbc -pass env:ENCRYPTION_PASSWORD -in ./build/deploy_key.pem.enc -out local.deploy_key.pem -d | ||
|
||
if [[ "${TRAVIS_BRANCH}" == "master" && $(cat version.sbt) != *"SNAPSHOT"* ]]; then | ||
eval "$(ssh-agent -s)" | ||
chmod 600 local.deploy_key.pem | ||
ssh-add local.deploy_key.pem | ||
git config --global user.name "Finch CI" | ||
git config --global user.email "[email protected]" | ||
git remote set-url origin [email protected]:finagle/finch.git | ||
git checkout master || git checkout -b master | ||
git reset --hard origin/master | ||
|
||
echo 'Performing a release' | ||
sbt 'release cross with-defaults' | ||
elif [[ "${TRAVIS_BRANCH}" == "master" ]]; then | ||
echo 'Master build' | ||
${SBT_CMD} | ||
else | ||
echo 'Branch build' | ||
printf 'version in ThisBuild := "%s-SNAPSHOT"' "${TRAVIS_BRANCH}" > version.sbt | ||
${SBT_CMD} | ||
fi | ||
else | ||
echo 'PR build' | ||
${SBT_CMD} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version in ThisBuild := "0.25.0-SNAPSHOT" |