From 146e9e9db5f50dddf8604542fef48b0269541caa Mon Sep 17 00:00:00 2001 From: Sebastian Erives Date: Tue, 19 Nov 2024 03:58:34 -0600 Subject: [PATCH] Add maven central publishing --- .github/workflows/release-central.yml | 26 +++++++++++++++++++++ LICENSE | 21 +++++++++++++++++ build.gradle | 29 +++++++----------------- example/build.gradle | 3 +-- gradle.properties | 19 ++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 1 - 7 files changed, 76 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/release-central.yml create mode 100644 LICENSE create mode 100644 gradle.properties diff --git a/.github/workflows/release-central.yml b/.github/workflows/release-central.yml new file mode 100644 index 0000000..4478628 --- /dev/null +++ b/.github/workflows/release-central.yml @@ -0,0 +1,26 @@ +name: Publish package to the Maven Central Repository +on: + push: + # Pattern matched against refs/tags + tags: + - '*' # Push events to every tag not containing / +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + - name: Run chmod to make gradlew executable + run: chmod +x ./gradlew + - name: Publish package to maven central + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} + run: | + ./gradlew :publishToMavenCentral --no-configuration-cache \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..313e2b4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 deltacv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/build.gradle b/build.gradle index b50f86b..5107980 100644 --- a/build.gradle +++ b/build.gradle @@ -4,15 +4,16 @@ import java.time.format.DateTimeFormatter plugins { id 'java-library' - id 'maven-publish' + id 'signing' + id "com.vanniktech.maven.publish" version "0.30.0" } -group 'com.github.deltacv' -version '2.1.0-B' +group 'org.deltacv' +version '2.1.0-C' java { toolchain { - languageVersion = JavaLanguageVersion.of(10) + languageVersion = JavaLanguageVersion.of(11) } } @@ -25,31 +26,17 @@ sourceSets { } } -task sourcesJar(type: Jar) { - from sourceSets.main.allJava - archiveClassifier = "sources" -} - -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - artifact sourcesJar - } - } -} - repositories { mavenCentral() maven { url 'https://jitpack.io' } } dependencies { - implementation 'com.github.deltacv.EOCV-Sim:Common:3.7.1' + implementation 'org.deltacv.EOCV-Sim:Common:3.8.4' compileOnly "org.openpnp:opencv:4.5.5-1" } -task(writeBuildClassJava) { +tasks.register('writeBuildClassJava') { String date = DateTimeFormatter.ofPattern("yyyy-M-d hh:mm:ss").format(LocalDateTime.now()) File versionFile = Paths.get( @@ -65,7 +52,7 @@ task(writeBuildClassJava) { " * Autogenerated file! Do not manually edit this file, as\n" + " * it is regenerated any time the build task is run.\n" + " *\n" + - " * Based from PhotonVision PhotonVersion generator task\n"+ + " * Based from PhotonVision PhotonVersion generator task\n" + " */\n" + "@SuppressWarnings(\"ALL\")\n" + "public final class Build {\n" + diff --git a/example/build.gradle b/example/build.gradle index 15be3fd..a1fe389 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -4,7 +4,7 @@ plugins { java { toolchain { - languageVersion = JavaLanguageVersion.of(10) + languageVersion = JavaLanguageVersion.of(11) } } @@ -12,7 +12,6 @@ group 'com.github.deltacv' repositories { mavenCentral() - maven { url 'https://jitpack.io' } } dependencies { diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..71c2a54 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,19 @@ +// or when publishing to https://central.sonatype.com/ +SONATYPE_HOST=CENTRAL_PORTAL +RELEASE_SIGNING_ENABLED=true + +POM_DESCRIPTION=Thin binding of AprilRobotics/apriltag for the JVM, based on the EOCV-AprilTag-Plugin +POM_INCEPTION_YEAR=2024 +POM_URL=https://github.com/deltacv/AprilTagDesktop/ + +POM_LICENSE_NAME=MIT License +POM_LICENSE_URL=https://opensource.org/license/mit +POM_LICENSE_DIST=repo + +POM_SCM_URL=https://github.com/deltacv/AprilTagDesktop/ +POM_SCM_CONNECTION=scm:git:git://github.com/deltacv/AprilTagDesktop.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/deltacv/AprilTagDesktop.git + +POM_DEVELOPER_ID=serivesmejia +POM_DEVELOPER_NAME=Sebastian Erives +POM_DEVELOPER_URL=https://github.com/serivesmejia/ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 15de902..a595206 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index dddb8d7..d8052f6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,5 +12,4 @@ plugins { rootProject.name = 'AprilTagDesktop' -include 'RobotCore' include 'example' \ No newline at end of file