Skip to content

Commit b6847a8

Browse files
authored
[LB-20] Add README instructions to install the SDK (#2)
1 parent 160d4ac commit b6847a8

File tree

2 files changed

+49
-14
lines changed

2 files changed

+49
-14
lines changed

.github/workflows/release.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 🛠️ Publish to GitHub Packages
1+
name: 🛠️ Publish to Sonatype
22

33
on:
44
release:
@@ -20,31 +20,39 @@ jobs:
2020
java-version: "21"
2121
distribution: "temurin"
2222

23-
# Step 3: Setup Gradle
23+
# Step 3: Set up GPG
24+
- name: Set up GPG key
25+
run: |
26+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
27+
echo "$GPG_PASSPHRASE" | gpg --batch --passphrase-fd 0 --pinentry-mode loopback --sign
28+
29+
# Step 4: Setup Gradle
2430
- name: Setup Gradle
2531
uses: gradle/actions/setup-gradle@v3
2632
with:
2733
cache-read-only: false
2834

29-
# Step 4: Grant execute permissions to gradlew
35+
# Step 5: Grant execute permissions to gradlew
3036
- name: Grant execute permissions to gradlew
3137
run: chmod +x ./gradlew
3238

33-
# Step 5: Set version based on the release tag
39+
# Step 6: Set version based on the release tag
3440
- name: Set version based on release tag
3541
run: echo VERSION=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\///') >> $GITHUB_ENV
3642

37-
# Step 6: Build the project using Gradle
43+
# Step 7: Build the project using Gradle
3844
- name: Build with Gradle
3945
run: ./gradlew build
4046

41-
# Step 7: Publish the project to GitHub Packages
42-
- name: Publish to GitHub Packages
47+
# Step 8: Publish the project to Sonatype OSSRH
48+
- name: Publish to Sonatype OSSRH
4349
run: ./gradlew publish -Pversion=$VERSION
4450
env:
4551
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
53+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
4654

47-
# Step 8: Send notification to Discord
55+
# Step 9: Send notification to Discord
4856
- name: Send notification to Discord
4957
uses: SethCohen/[email protected]
5058
with:

build.gradle

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id 'java'
33
id 'maven-publish'
4+
id 'signing' // Add signing plugin for GPG signing
45
}
56

67
group = 'gg.launchblock'
@@ -15,7 +16,7 @@ java {
1516
}
1617

1718
repositories {
18-
mavenCentral()
19+
mavenCentral() // Use Maven Central repository
1920
}
2021

2122
dependencies {
@@ -31,16 +32,42 @@ publishing {
3132
publications {
3233
mavenJava(MavenPublication) {
3334
from components.java
35+
36+
// Include POM customizations (if needed)
37+
pom {
38+
name = 'LaunchBlock Java SDK'
39+
description = 'A Java SDK for interacting with the LaunchBlock API'
40+
url = 'https://github.com/LaunchBlockMC/sdk-java'
41+
licenses {
42+
license {
43+
name = 'Apache License, Version 2.0' as Publication
44+
url = 'http://www.apache.org/licenses/LICENSE-2.0' as Publication
45+
}
46+
}
47+
scm {
48+
connection = 'scm:git:[email protected]:LaunchBlockMC/sdk-java.git' as Publication
49+
developerConnection = 'scm:git:[email protected]:LaunchBlockMC/sdk-java.git' as Publication
50+
url = 'https://github.com/LaunchBlockMC/sdk-java' as Publication
51+
}
52+
}
3453
}
3554
}
3655
repositories {
3756
maven {
38-
name = "GitHubPackages"
39-
url = uri("https://maven.pkg.github.com/LaunchBlockMC/sdk-java")
57+
name = "SonatypeOSS"
58+
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") // Sonatype's repository
59+
4060
credentials {
41-
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
42-
password = project.findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
61+
username = project.findProperty("sonatypeUsername") ?: System.getenv("SONATYPE_USERNAME")
62+
password = project.findProperty("sonatypePassword") ?: System.getenv("SONATYPE_PASSWORD")
4363
}
4464
}
4565
}
46-
}
66+
}
67+
68+
signing {
69+
useGpgCmd()
70+
// Ensure the project is signed
71+
sign publishing.publications.mavenJava
72+
}
73+

0 commit comments

Comments
 (0)