Skip to content

Commit fb15562

Browse files
Merge pull request #42 from Infisical/daniel/move-java-sdk
feat(java): move sdk to central maven repository
2 parents 77d2b43 + 56ea093 commit fb15562

File tree

3 files changed

+60
-38
lines changed

3 files changed

+60
-38
lines changed

.github/workflows/release-java.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Release Java SDK
22
run-name: Release Java SDK
33

44
on:
5-
workflow_dispatch:
6-
75
push:
86
tags:
97
- "*.*.*" # version, e.g. 1.0.0
@@ -97,11 +95,12 @@ jobs:
9795
ls -R languages/java/src/main/resources
9896
9997
- name: Publish Maven
100-
uses: gradle/gradle-build-action@b5126f31dbc19dd434c3269bf8c28c315e121da2 # v2.8.1
101-
with:
102-
arguments: publish
103-
build-root-directory: languages/java
98+
working-directory: languages/java
99+
run: |
100+
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
104101
env:
105-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106-
MVN_USERNAME: ${{ secrets.MVN_USERNAME }}
107-
MVN_TOKEN: ${{ secrets.MVN_TOKEN }}
102+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
103+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
104+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.INFISICAL_GDP_KEY }}
105+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.INFISICAL_GDP_KEY_ID }} # Last 8 characters of the full key ID
106+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.INFISICAL_GDP_KEY_PASSWORD }}

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,6 @@ languages/csharp/Infisical.Sdk.Samples/bin/**/*
196196

197197
languages/node/npm/**/*.node
198198
languages/node/artifacts
199-
languages/node/package/**/*
199+
languages/node/package/**/*
200+
201+
languages/java/gradle.properties

languages/java/build.gradle

+49-28
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22
* This file was generated by the Gradle 'init' task.
33
*/
44

5+
import com.vanniktech.maven.publish.SonatypeHost
6+
7+
58

69
plugins {
710
id 'java-library'
811
id 'maven-publish'
12+
id "com.vanniktech.maven.publish" version "0.29.0"
13+
id 'signing'
914
}
1015

1116
group 'com.infisical'
1217

18+
group = rootProject.group
19+
1320
repositories {
1421
mavenCentral()
1522
maven {
@@ -22,35 +29,49 @@ repositories {
2229
api 'net.java.dev.jna:jna-platform:5.12.1'
2330
}
2431

25-
description = 'InfisicalSDK'
26-
java.sourceCompatibility = JavaVersion.VERSION_1_8
27-
28-
publishing {
29-
publications {
30-
maven(MavenPublication) {
31-
groupId = 'com.infisical'
32-
artifactId = 'sdk'
33-
34-
// Get the latest tag that we'll use for the release
35-
def gitTag = 'git describe --tags --abbrev=0'.execute().text.trim()
36-
version = "${gitTag}-SNAPSHOT"
37-
38-
afterEvaluate {
39-
from components.java
40-
}
41-
}
42-
}
43-
repositories {
44-
maven {
45-
name = "OSSRH"
46-
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
47-
credentials {
48-
username = System.getenv("MVN_USERNAME")
49-
password = System.getenv("MVN_TOKEN")
50-
}
51-
}
52-
}
32+
description = 'InfisicalSDK'
33+
java.sourceCompatibility = JavaVersion.VERSION_1_8
34+
}
35+
36+
37+
38+
mavenPublishing {
39+
40+
// Get the latest tag that we'll use for the release
41+
def gitTag = 'git describe --tags --abbrev=0'.execute().text.trim()
42+
version = gitTag
43+
44+
coordinates("com.infisical", "sdk", version)
45+
46+
47+
pom {
48+
name = "Infisical SDK"
49+
description = "Official Java SDK for Infisical"
50+
inceptionYear = "2023"
51+
url = "https://github.com/infisical/sdk"
52+
licenses {
53+
license {
54+
name = "MIT License"
55+
url = "https://opensource.org/license/MIT"
56+
distribution = "repo"
57+
}
5358
}
59+
developers {
60+
developer {
61+
id = "danielhougaard"
62+
name = "Daniel Hougaard"
63+
url = "https://github.com/danielhougaard/"
64+
}
65+
}
66+
scm {
67+
url = "https://github.com/infisical/sdk/"
68+
connection = "scm:git:git://github.com/infisical/sdk.git"
69+
developerConnection = "scm:git:ssh://git@github.com/infiscial/sdk.git"
70+
}
71+
}
72+
73+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
74+
signAllPublications()
5475
}
5576

5677
tasks.withType(JavaCompile) {

0 commit comments

Comments
 (0)