Merge pull request #117 from abeaumont/feature/maven-publish-jar

Maven publish jar
This commit is contained in:
Alfredo Beaumont 2017-10-02 14:53:57 +02:00 committed by GitHub
commit 95ef0a6cf3
5 changed files with 82 additions and 2 deletions

View File

@ -113,3 +113,39 @@ jobs:
skip_cleanup: true
on:
tags: true
- stage: Publish Maven
language: scala
jdk: oraclejdk8
before_script:
- if [[ -z "$TRAVIS_TAG" ]]; then echo "Skipping this build for non-tag builds."; exit 0; fi
- cd java
- make
- curl -o ./shared/linux-x86-64/libenry.so -sL "https://github.com/$TRAVIS_REPO_SLUG/releases/download/$TRAVIS_TAG/libenry.so"
- mkdir -p ./shared/darwin
- curl -o ./shared/darwin/libenry.dylib -sL "https://github.com/$TRAVIS_REPO_SLUG/releases/download/$TRAVIS_TAG/libenry.dylib"
- openssl aes-256-cbc -K $encrypted_a0e1c69dbbc7_key -iv $encrypted_a0e1c69dbbc7_iv -in key.asc.enc -out key.asc -d
- gpg --no-default-keyring --primary-keyring ./project/.gnupg/pubring.gpg --secret-keyring ./project/.gnupg/secring.gpg --keyring ./project/.gnupg/pubring.gpg --fingerprint --import key.asc
script:
- make test # ensure the shared objects are functional
- ./sbt publishLocal
- ./sbt publishSigned
- ./sbt sonatypeRelease
before_deploy:
- rm ./target/enry-java-*-javadoc.jar
- rm ./target/enry-java-*-sources.jar
- rm ./target/enry-java-*-tests.jar
- rm ./target/enry-java-assembly-*.jar
deploy:
provider: releases
api_key:
secure: $GITHUB_TOKEN
file_glob: true
file: ./target/enry-java*.jar
skip_cleanup: true
on:
tags: true

4
java/.gitignore vendored
View File

@ -25,3 +25,7 @@ target
.jnaerator
shared
*.jar
*.gpg
key.asc
project/.gnupg

View File

@ -1,12 +1,40 @@
name := "enry-java"
organization := "tech.sourced"
version := "1.0"
version := "1.0.0"
sonatypeProfileName := "tech.sourced"
// pom settings for sonatype
homepage := Some(url("https://github.com/src-d/enry"))
scmInfo := Some(ScmInfo(url("https://github.com/src-d/enry"),
"git@github.com:src-d/enry.git"))
developers += Developer("abeaumont",
"Alfredo Beaumont",
"alfredo@sourced.tech",
url("https://github.com/abeaumont"))
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
pomIncludeRepository := (_ => false)
crossPaths := false
autoScalaLibrary := false
publishMavenStyle := true
exportJars := true
val SONATYPE_USERNAME = scala.util.Properties.envOrElse("SONATYPE_USERNAME", "NOT_SET")
val SONATYPE_PASSWORD = scala.util.Properties.envOrElse("SONATYPE_PASSWORD", "NOT_SET")
credentials += Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
SONATYPE_USERNAME,
SONATYPE_PASSWORD)
val SONATYPE_PASSPHRASE = scala.util.Properties.envOrElse("SONATYPE_PASSPHRASE", "not set")
useGpg := false
pgpSecretRing := baseDirectory.value / "project" / ".gnupg" / "secring.gpg"
pgpPublicRing := baseDirectory.value / "project" / ".gnupg" / "pubring.gpg"
pgpPassphrase := Some(SONATYPE_PASSPHRASE.toArray)
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test
unmanagedBase := baseDirectory.value / "lib"
@ -23,3 +51,13 @@ artifact in (Compile, assembly) := {
}
addArtifact(artifact in (Compile, assembly), assembly)
isSnapshot := version.value endsWith "SNAPSHOT"
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")
}

BIN
java/key.asc.enc Normal file

Binary file not shown.

View File

@ -1 +1,3 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")