-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
starts the effort to simplify artifact release #995
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, what's interesting is I have gpg 2.2.10 installed locally and it doesn't use the
I'm not sure which version of gpg utility sbt-gpg depends on so perhaps I should downgrade to make sure I generate both files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nevermind. I'll modify the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided to use the older version of GPG I installed via
|
||
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> | ||
|
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does commit the new version back? Or maybe we aren't doing it yet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The magic seems to be part of the Used as part of the release process defined here https://github.com/finagle/finch/pull/995/files#diff-fdc3abdfd754eeb24090dbd90aeec2ceR131 TBH, i haven't tested the release process yet. I have an internal jfrog account where i can test with a sandbox repo. Maybe i can create a dummy repo to test out the versioning. I also need to read up a bit more on Wasn't super familiar with this plugin but seems like it can do a bit more than what is currently being done. Seems like it can apparently automate release notes? |
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version in ThisBuild := "0.25.0-SNAPSHOT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should just give up on built matrix and start using
build.sh
? It seems to be what Flavio is doing for Arrows (https://github.com/traneio/arrows/blob/master/.travis.yml).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fwbrasil i see you went through a couple of different iterations on doing cross builds to finally hardcoding
2.12
in your build script. Any helpful gotchas that you discovered in the process?