Skip to content
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

Make release steps agree with Travis stages #2575

Merged
merged 1 commit into from
May 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 5 additions & 23 deletions project/Http4sPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ object Http4sPlugin extends AutoPlugin {
object autoImport {
val isTravisBuild = settingKey[Boolean]("true if this build is running as either a PR or a release build within Travis CI")
val http4sMimaVersion = settingKey[Option[String]]("Version to target for MiMa compatibility")
val http4sPrimary = settingKey[Boolean]("Is this the primary build?")
val http4sPublish = settingKey[Boolean]("Is this a publishing build?")
val http4sMasterBranch = settingKey[Boolean]("Is this the master branch?")
val http4sApiVersion = taskKey[(Int, Int)]("API version of http4s")
val http4sJvmTarget = taskKey[String]("JVM target")
val http4sBuildData = taskKey[Unit]("Export build metadata for Hugo")
Expand All @@ -37,22 +35,15 @@ object Http4sPlugin extends AutoPlugin {
// Many steps only run on one build. We distinguish the primary build from
// secondary builds by the Travis build number.
isTravisBuild := sys.env.get("TRAVIS").isDefined,
http4sPrimary := sys.env.get("TRAVIS_JOB_NUMBER").fold(true)(_.endsWith(".1")),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been ever since we introduced stages, and why we've had to manually tag and bump the last few releases. It's obsolete.


// Publishing to gh-pages and sonatype only done from select branches and
// never from pull requests.
http4sPublish := {
sys.env.get("TRAVIS").contains("true") &&
sys.env.get("TRAVIS_PULL_REQUEST").contains("false") &&
sys.env.get("TRAVIS_REPO_SLUG").contains("http4s/http4s") &&
sys.env.get("TRAVIS_JDK_VERSION").contains("oraclejdk8") &&
(sys.env.get("TRAVIS_BRANCH") match {
case Some("master") => true
case Some(branch) if branch.startsWith("series/") => true
case _ => false
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old TRAVIS_BRANCH check is covered by .travis.yml. The old oraclejdk8 reference is why #2570 failed to publish, and is also adequately covered by .travis.yml.

sys.env.get("TEST").contains("publish")
},
http4sMasterBranch := sys.env.get("TRAVIS_BRANCH").contains("master"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only used to determine whether we publish the site. That has been moved to .travis.yml.

ThisBuild / http4sApiVersion := (ThisBuild / version).map {
case VersionNumber(Seq(major, minor, _*), _, _) => (major.toInt, minor.toInt)
}.value,
Expand Down Expand Up @@ -184,28 +175,19 @@ object Http4sPlugin extends AutoPlugin {

val release = !isSnapshot.value
val publishable = http4sPublish.value
val primary = http4sPrimary.value
val master = http4sMasterBranch.value

Seq(
checkSnapshotDependencies.when(release),
inquireVersions.when(release),
setReleaseVersion.when(release),
tagRelease.when(primary && release),
tagRelease.when(publishable && release),
runClean,
// runTest,
releaseStepCommandAndRemaining("+mimaReportBinaryIssues"),
// releaseStepCommand("unusedCompileDependenciesTest"),
// releaseStepCommand("test:scalafmt::test").when(primary),
// releaseStepCommand("docs/makeSite").when(primary),
// releaseStepCommand("website/makeSite").when(primary),
releaseStepCommandAndRemaining("+publishSigned").when(publishable),
releaseStepCommand("sonatypeReleaseAll").when(publishable && release),
// releaseStepCommand("docs/ghpagesPushSite").when(publishable && primary),
// releaseStepCommand("website/ghpagesPushSite").when(publishable && primary && master),
setNextVersion.when(publishable && primary && release),
commitNextVersion.when(publishable && primary && release),
pushChanges.when(publishable && primary && release),
setNextVersion.when(publishable && release),
commitNextVersion.when(publishable && release),
pushChanges.when(publishable && release),
// We need a superfluous final step to ensure exit code
// propagation from failed steps above.
//
Expand Down