From 0bb8b6dba0be2096be07568cfde7f4ab768d4c2b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Nov 2025 09:36:24 +0000 Subject: [PATCH 1/2] Initial plan From 9cab54f4f4aa14a1b589841c96e116b4f46fea33 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Nov 2025 09:43:05 +0000 Subject: [PATCH 2/2] Configure Maven publishing to GitHub Packages Co-authored-by: zepinto <1562009+zepinto@users.noreply.github.com> --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ build.gradle | 19 +++++++++++++++---- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e8d903a..1b9616c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,55 @@ imcjava supports multiple IMC versions. Use `./gradlew generate` to create the bindings. +# Publishing + +## Test Locally + Use `./gradlew publishToMavenLocal` to test locally. +## Publish to GitHub Packages + +To publish to GitHub Packages Maven repository: + +```bash +export GITHUB_ACTOR=your-github-username +export GITHUB_TOKEN=your-github-token +./gradlew publish +``` + +Or publish only to GitHub Packages: + +```bash +./gradlew publishAllPublicationsToGitHubPackagesRepository +``` + +Alternatively, you can set credentials in `~/.gradle/gradle.properties`: + +```properties +gpr.user=your-github-username +gpr.key=your-github-token +``` + +## Using the Package + +To use the published package in your project, add the following to your `build.gradle`: + +```groovy +repositories { + maven { + url = uri("https://maven.pkg.github.com/oceanscan/imcjava") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") + } + } +} + +dependencies { + implementation 'pt.lsts:imcjava:5.5.5-unify' +} +``` + +## Legacy Publishing + `mvn_update.sh` to publish the current build to omst's maven repository. \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2ce30e1..9762d89 100644 --- a/build.gradle +++ b/build.gradle @@ -82,14 +82,25 @@ publishing { publications { mavenJava(MavenPublication) { from components.java + groupId = 'pt.lsts' + artifactId = 'imcjava' + version = project.version } } -} - -publishing { + repositories { maven { - url "file://" + System.getProperty("user.home") + "/maven" + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/oceanscan/imcjava") + credentials { + username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user") + password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.key") + } + } + // Keep local publishing for testing + maven { + name = "Local" + url = "file://" + System.getProperty("user.home") + "/maven" } } }