Skip to content

Commit

Permalink
Add maven central publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
serivesmejia committed Nov 19, 2024
1 parent bff63bf commit 146e9e9
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 25 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release-central.yml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
29 changes: 8 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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(
Expand All @@ -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" +
Expand Down
3 changes: 1 addition & 2 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ plugins {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(10)
languageVersion = JavaLanguageVersion.of(11)
}
}

group 'com.github.deltacv'

repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}

dependencies {
Expand Down
19 changes: 19 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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://[email protected]/deltacv/AprilTagDesktop.git

POM_DEVELOPER_ID=serivesmejia
POM_DEVELOPER_NAME=Sebastian Erives
POM_DEVELOPER_URL=https://github.com/serivesmejia/
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ plugins {

rootProject.name = 'AprilTagDesktop'

include 'RobotCore'
include 'example'

0 comments on commit 146e9e9

Please sign in to comment.