Skip to content

Commit

Permalink
Merge branch 'features/sbt-best-practice-sonatype-release' into template
Browse files Browse the repository at this point in the history
  • Loading branch information
Atry committed Dec 8, 2017
2 parents 9fa7f00 + 1d2ae85 commit 4269156
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions deploy.sbt.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ enablePlugins(Travis)

enablePlugins(SonatypeRelease)

lazy val secret = project settings(publishArtifact := false) configure { secret =>
sys.env.get("GITHUB_PERSONAL_ACCESS_TOKEN") match {
case Some(pat) =>
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider
secret.addSbtFilesFromGit(
"https://github.com/ThoughtWorksInc/tw-data-china-continuous-delivery-password.git",
new UsernamePasswordCredentialsProvider(pat, ""),
file("secret.sbt"))
case None =>
secret
}
lazy val secret = project.settings(publishArtifact := false).in {
val secretDirectory = file(sourcecode.File()).getParentFile / "secret"
org.apache.commons.io.FileUtils.deleteDirectory(secretDirectory)
org.eclipse.jgit.api.Git
.cloneRepository()
.setURI("https://github.com/ThoughtWorksInc/tw-data-china-continuous-delivery-password.git")
.setDirectory(secretDirectory)
.setCredentialsProvider(
new org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider(sys.env("GITHUB_PERSONAL_ACCESS_TOKEN"), "")
)
.call()
.close()
secretDirectory
}

0 comments on commit 4269156

Please sign in to comment.