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" } } }