Skip to content

Commit c28a153

Browse files
authored
publish artifacts to sonatype and maven central (#25)
* publish artifacts to sonatype and maven central * dummy commit * fixed travis file * fix to travis.yml
1 parent 5e9f523 commit c28a153

File tree

7 files changed

+60
-18
lines changed

7 files changed

+60
-18
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
target/
2-
.idea/
2+
.idea/
3+
local.*

.travis.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,20 @@ services:
88
scala:
99
- 2.12.4
1010

11+
before_install:
12+
- if [ $TRAVIS_PULL_REQUEST = 'false' ]; then openssl aes-256-cbc -K $encrypted_575a6d494c46_key
13+
-iv $encrypted_575a6d494c46_iv -in travis/secrets.tar.enc -out travis/secrets.tar
14+
-d; tar xv -C travis -f travis/secrets.tar; fi
15+
1116
script:
1217
- ./test.sh
1318

19+
after_success:
20+
# send every push to master to sonatype
21+
- if [ -z "$TRAVIS_PULL_REQUEST_BRANCH" ] && [ "$TRAVIS_BRANCH" = "master" ]; then { sbt publishSigned ;} fi;
22+
# send releases / tags to maven central
23+
- if [ -z "$TRAVIS_PULL_REQUEST_BRANCH" ] && [ -n "$TRAVIS_TAG" ]; then { sbt sonatypeRelease ; } fi;
24+
1425
# Improvement: move logic out of docker_push.sh into .travis.yml
1526
deploy:
1627
- provider: script
@@ -29,7 +40,6 @@ deploy:
2940
# condition: "foo == bar && baz==bat"
3041
# repo: simplesteph/kafka-security-manager
3142

32-
3343
before_cache:
3444
# Tricks to avoid unnecessary cache updates
3545
- find $HOME/.sbt -name "*.lock" | xargs rm
@@ -38,4 +48,4 @@ before_cache:
3848
cache:
3949
directories:
4050
- $HOME/.ivy2/cache
41-
- $HOME/.sbt
51+
- $HOME/.sbt

build.sbt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,7 @@ PB.targets in Compile := Seq(
6060
grpcgateway.generators.SwaggerGenerator -> (resourceDirectory in Compile).value / "specs",
6161
// generate the Rest Gateway source code
6262
grpcgateway.generators.GatewayGenerator -> (sourceManaged in Compile).value
63-
)
63+
)
64+
65+
// Add the default sonatype repository setting
66+
publishTo := sonatypePublishTo.value

project/plugins.sbt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.3")
77
resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
88

99
addSbtPlugin("com.artima.supersafe" % "sbtplugin" % "1.1.4")
10+
11+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
12+
13+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")

sonatype.sbt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Your profile name of the sonatype account. The default is the same with the organization value
2+
sonatypeProfileName := "com.github.simplesteph"
3+
4+
// To sync with Maven central, you need to supply the following information:
5+
publishMavenStyle := true
6+
7+
// License of your choice
8+
licenses ++= Seq("MIT" -> url("https://github.com/simplesteph/kafka-security-manager/blob/master/LICENSE.txt"))
9+
10+
// Where is the source code hosted
11+
import xerial.sbt.Sonatype._
12+
sonatypeProjectHosting := Some(GitHubHosting("simplesteph", "kafka-security-manager", "[email protected]"))
13+
14+
developers := List(Developer(id="simplesteph",name="Stephane Maarek",email="[email protected]",url= url("https://github.com/simplesteph")))
15+
16+
credentials ++= (for {
17+
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
18+
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
19+
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
20+
21+
22+
pgpPublicRing := file("./travis/local.pubring.asc")
23+
pgpSecretRing := file("./travis/local.secring.asc")
24+
pgpPassphrase := Option(System.getenv().get("PGP_PASS").toCharArray)

src/main/resources/specs/KsmService.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ paths:
2727
schema:
2828
$ref: "#/definitions/GetAllAclsResponse"
2929
definitions:
30+
KafkaPrincipalPb:
31+
type: object
32+
properties:
33+
principalType:
34+
type: string
35+
name:
36+
type: string
3037
ResourcePb:
3138
type: object
3239
properties:
@@ -42,6 +49,13 @@ definitions:
4249
- RESOURCE_TYPE_CLUSTER
4350
- RESOURCE_TYPE_TRANSACTIONALID
4451
- RESOURCE_TYPE_DELEGATIONTOKEN
52+
ResourceAndAclPb:
53+
type: object
54+
properties:
55+
resource:
56+
$ref: "#/definitions/ResourcePb"
57+
acl:
58+
$ref: "#/definitions/AclPb"
4559
AclPb:
4660
type: object
4761
properties:
@@ -72,20 +86,6 @@ definitions:
7286
- OPERATION_TYPE_ALTERCONFIGS
7387
- OPERATION_TYPE_IDEMPOTENTWRITE
7488
- OPERATION_TYPE_ALL
75-
KafkaPrincipalPb:
76-
type: object
77-
properties:
78-
principalType:
79-
type: string
80-
name:
81-
type: string
82-
ResourceAndAclPb:
83-
type: object
84-
properties:
85-
resource:
86-
$ref: "#/definitions/ResourcePb"
87-
acl:
88-
$ref: "#/definitions/AclPb"
8989
GetAllAclsRequest:
9090
type: object
9191
GetAllAclsResponse:

travis/secrets.tar.enc

8.02 KB
Binary file not shown.

0 commit comments

Comments
 (0)