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

publish and release utils module #65

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
37 changes: 24 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,33 @@ language: scala
sudo: false
jdk:
- oraclejdk8
script: "./build.sh"
before_cache:
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm
# List of environment variables are
# - SONATYPE_USERNAME
# - SONATYPE_PASSWORD
env:
matrix:
- BUILD_LABEL=4.0.${TRAVIS_BUILD_NUMBER}
global:
- secure: WNb8qjMw+svqsW51cZcxvYy3Z8fqJrB3a0x+KjR064qv8Y6xIc+Y/LDG78WHSG6NQemW8RiEVv85ip3VzbXUOq8h4PUlRe/prBSPVcC5ano12NK5E1hUlx7njrGpEtgMYQuh87ByEDcn1UPuKE72RMwELDGmI8FWEV6vaQpCnAtKYcR476g7Nlh2yFSBs+++2mEdRkY9ADLjOv67wLtbpS6KUlevu5V1z73njPqJ2vOkFzO5U1AK9UMUPHnsXqECm/wzPOqQvBp+2JwSBhvHbcK2duJ8DXj3eH0vx9YdCv1FyOGZBLdTRQhBjPOdsicbKir5BDN13l+DdYb0hgLORXLf/QonO+iO+5z5HpkXKsecKcXdE2CqHyOYXkNzhbaNMy6dHVlCdgvRW3lsglo8mL27aNlgcPOhLCV+Linte5QMpPzoUEQaykPTqBnQSVdn9th2SxMxY7mSamCFX8JlOE82hqTF0074GexqLHtLLQmbJKpDsqCddSsCcJ37pjqg/u5XuMPOcLtCgJt2m6dyKC9tEPIfgUO+tRxDaNYjv67XXRHk3yR/h2RqnApgn2QriX93hNUjiADLxx4fxAfNsTQHATYivjD7SH33ryyrR8agNTv3CAvAQH20/NtSXJKtt7k+sr2WcdAZSx8Y7g/sDar5X8wakZwtm/1oOBGgwcg=
- secure: PcraIZXoMP9ru/m5k/ztEOTPA+qxkZbQLMxEmdAizVDvnvfVQVxAneCtbjOzb7u773YRpV1qSY2e81uOCzH4cSqp5672e5dHHEyN5LuJLH0DbpbbgVOdKRa9cYLq5pavNeEBZTFrmXGdXLV2U9YdrG0PtSyzSLsCEVEUMhs4f6Y6y2dWJ9SKo0eWlclwYNO2wNoimf6f/ekA43DUDYs6kBlKseZUXNShSkTp2utVq0YnxgfmVffEhdsUGIdKd27aEImZBIGbLrGWqUdhP4vFpF7O+ZvixalmhGpq/4SB9UmbEX9BROvj84brHf3fH3g4W4Ka8UqHK8JQ3JHePx+Y34YXhv/im7aip3yn9U9WLnCOAa7LQt1CHm31mXWmKuAt4G6Qc4J8ch8aqBU9tl4wcp6SNGHYrv7eiq09OKoyYpVe5ZPVHh+PjkHXmznT4ywHCGa68kHYgIL3jO4gYSDxzgYudgOlwC5vU5ipdE/yP460ya28m2PKAnWM+TSbUdSkuZcVcWNgTCUr7KBw4eK3qK/XOqxG7DXsbzZE2I76HozrygubfMpSJc339Q/EsXI67ersjz1aPgXlq/ikppahRufikgu30p8S9TcHd4C7P0ui9HcqWdCRz3mt7GBySfosIN90HdySo+lCrTDG84tm70Hrj9g0K6bJKBTnmYH0pGc=
cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot/
env:
- BUILD_LABEL=4.0.${TRAVIS_BUILD_NUMBER}
- "$HOME/.ivy2/cache"
- "$HOME/.sbt/boot/"
script: "./build.sh"
before_cache:
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm
before_install:
- openssl aes-256-cbc -pass pass:$SONATYPE_PASSWORD -in .travis/secring.gpg.enc -out local.secring.gpg -d
- openssl aes-256-cbc -pass pass:$SONATYPE_PASSWORD -in .travis/pubring.gpg.enc -out local.pubring.gpg -d
before_deploy:
- "./deploy.sh"
- nvm install v7.8.0
- nvm use v7.8.0
- npm install -g yarn
- "./docs/deploy.sh"
- ".travis/publish.sh"
- "./deploy.sh"
- nvm install v7.8.0
- nvm use v7.8.0
- npm install -g yarn
- "./docs/deploy.sh"
deploy:
- provider: releases
api_key:
Expand Down
14 changes: 14 additions & 0 deletions .travis/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

if ([ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]);
then
echo "Triggering a versioned release of the project"
echo "Attempting to publish signed jar"
sbt "project utils" +publishSigned
echo "Published the signed jar"
echo "Attempting to make a release of the sonatype staging"
sbt sonatypeReleaseAll
echo "Released the sonatype staging setup"
else
echo "Not running publish since we're either not in master or in a Pull Request"
fi
Binary file added .travis/pubring.gpg.enc
Binary file not shown.
Binary file added .travis/secring.gpg.enc
Binary file not shown.
49 changes: 48 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ lazy val commonSettings = Seq(
Seq(outputFile)
}.taskValue,
mappings in (Compile, packageBin) += {
(resourceManaged in Compile).value / "plugin.xml" -> "plugin.xml"
(resourceManaged in Compile).value / "plugin.xml" -> "plugin.xml"
},
javacOptions ++= Seq("-source", "1.8", "-target", "1.8")
)

lazy val utils = (project in file("utils")).
settings(commonSettings: _*).
settings(publishSettings: _*).
settings(
name := "utils",
crossPaths := false,
Expand Down Expand Up @@ -87,3 +88,49 @@ lazy val fetch = (project in file("fetch")).
junit, mockito
)
)


lazy val publishSettings = Seq(
publishMavenStyle := true,

pgpSecretRing := file("local.secring.gpg"),
pgpPublicRing := file("local.pubring.gpg"),
pgpPassphrase := Some(sys.env.getOrElse("GPG_PASSPHRASE", "").toCharArray),

credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
System.getenv("SONATYPE_USERNAME"),
System.getenv("SONATYPE_PASSWORD")),

publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},

publishArtifact in Test := false,
publishArtifact in(Compile, packageSrc) := true,
pomIncludeRepository := { _ => false },
pomExtra :=
<url>https://github.com/indix/utils</url>
<licenses>
<license>
<name>Apache License</name>
<url>https://raw.githubusercontent.com/indix/gocd-s3-artifacts/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:indix/gocd-s3-artifacts.git</url>
<connection>scm:git:[email protected]:indix/gocd-s3-artifacts.git</connection>
</scm>
<developers>
<developer>
<id>indix</id>
<name>Indix</name>
<url>http://www.indix.com</url>
</developer>
</developers>
)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.0.1
sbt.version=1.1.6
5 changes: 4 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.10")
4 changes: 4 additions & 0 deletions sonatype.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
System.getenv("SONATYPE_USERNAME"),
System.getenv("SONATYPE_PASSWORD"))