Skip to content

Commit

Permalink
Merge branch 'main' into javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasSchaub committed Jul 5, 2023
2 parents aca24cd + ac7c64a commit fdbb12f
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/publish-javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ name: Deploy Javadoc
# And these need to be merged into the javadoc branch.

on:
#release: # to trigger this only at new releases, comment this in and the next three lines out
#types: [created, published, released]
push:
branches:
- main
release:
types: [published] #alternatives: released, published, created
#push:
#branches:
#- main

jobs:
publish:
Expand All @@ -22,4 +22,4 @@ jobs:
javadoc-branch: javadoc
java-version: 17
target-folder: javadoc
project: gradle
project: gradle
46 changes: 46 additions & 0 deletions .github/workflows/publish-to-maven-central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

#taken from: https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-gradle
# and extended using https://selectfrom.dev/using-github-actions-to-automatically-publish-gradle-build-artifacts-d71c915cfa4
name: Publish package to the Maven Central Repository
on:
#push:
#branches: [ "main" ]
release:
types: [published]
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: 'temurin'
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3
#- name: Publish package
#uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 #from the tutorial
##uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 #this is the action used in the other yml file, the Gradle build
#with:
#arguments: publish
#env:
#MAVEN_USERNAME: ${{ secrets.OSSRHUSERNAME }}
#MAVEN_PASSWORD: ${{ secrets.OSSRHPASSWORD }}
- name: Publish with Gradle #from the second tutorial
env:
MAVEN_PASSWORD: ${{secrets.OSSRHPASSWORD}}
MAVEN_USERNAME: ${{secrets.OSSRHUSERNAME}}
signingKey: ${{secrets.PGP_SECRET}}
signingPassword: ${{secrets.PGP_PASSPHRASE}}
run: ./gradlew publish --no-daemon
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cff-version: 1.2.0
title: ART2a-Clustering-for-Java
version: 1.0.0.0
version: 1.0.2.1
message: "If you use this software, please cite it as below."
type: software
authors:
Expand All @@ -19,7 +19,7 @@ authors:
- family-names: "Zielesny"
given-names: "Achim"
orcid: "https://orcid.org/0000-0003-0722-4229"
date-released: 2023-06-23
date-released: 2023-07-05
doi: "10.5281/zenodo.8075213"
url: "https://github.com/JonasSchaub/ART2a-Clustering-for-Java"
license: GPL-3.0
141 changes: 138 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,36 @@

plugins {
id 'application'
id 'org.gradle.java'
id 'java-library'
id 'java'
id("com.diffplug.spotless") version "6.19.0"
id 'org.gradle.maven-publish'
id 'signing'
}

group 'de.unijena.cheminf.clustering.art2a'
version '1.0.0.0'
group = 'io.github.jonasschaub'
archivesBaseName = 'ART2a-Clustering-for-Java'
//see also version for publishing below!
version = '1.0.2.1'

//sourceCompatibility = 1.17

//Creates javadoc and sources jars
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withJavadocJar()
withSourcesJar()
}

javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}

repositories {
mavenCentral()
}
Expand All @@ -43,6 +59,7 @@ dependencies {
testImplementation(platform('org.junit:junit-bom:5.9.1'))
testImplementation('org.junit.jupiter:junit-jupiter')
}

tasks.withType(Test).configureEach {
useJUnitPlatform()

Expand All @@ -69,4 +86,122 @@ spotless {
//prettier() //needs npm installed, unsuitable...
//clangFormat() //also needs an installation...
}
}
}

artifacts {
archives javadocJar, sourcesJar
}

publishing {
publications {
mavenJava(MavenPublication) {

groupId = 'io.github.jonasschaub'
artifactId = 'ART2a-Clustering-for-Java'
//note: this version has been published, do not try to publish it again! versions 1.0.1.0 and 1.0.1.1 were also already used for publishing!
version = '1.0.2.1'

from components.java

versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}

pom {

name = 'ART2a-Clustering-for-Java'
description = 'Implementation of the ART 2-A fingerprint clustering algorithm in Java.'
url = 'https://github.com/JonasSchaub/ART2a-Clustering-for-Java'

//this way, properties can be added:
//properties = [
//myProp: "value",
//"prop.with.dots": "anotherValue"
//]

licenses {
license {
name = 'GNU General Public License v3.0'
url = 'https://www.gnu.org/licenses/lgpl-3.0.txt'
}
}

developers {
developer {
id = 'B-s123'
name = 'Betuel Sevindik'
email = 'betuel.sevindik@studmail.w-hs.de'
url = 'https://github.com/B-s123'
}
developer {
id = 'FelixBaensch'
name = 'Felix Baensch'
email = 'felix.baensch@w-hs.de'
url = 'https://github.com/FelixBaensch'
}
developer {
id = 'JonasSchaub'
name = 'Jonas Schaub'
email = 'jonas.schaub@uni-jena.de'
url = 'https://github.com/JonasSchaub'
}
developer {
name = 'Christoph Steinbeck'
email = 'christoph.steinbeck@uni-jena.de'
url = 'https://cheminf.uni-jena.de/members/steinbeck/'
}
developer {
name = 'Achim Zielesny'
email = 'achim.zielesny@w-hs.de'
url = 'https://www.w-hs.de/service/informationen-zur-person/person/zielesny/'
}
}

scm {
connection = 'scm:git:git://github.com/JonasSchaub/ART2a-Clustering-for-Java.git'
developerConnection = 'scm:git:ssh://github.com/JonasSchaub/ART2a-Clustering-for-Java.git'
url = 'https://github.com/JonasSchaub/ART2a-Clustering-for-Java/'
}
}
}
}
repositories {
maven {
//these two lines did not work because dir() apparently asks for a local path
//def releasesRepoUrl = layout.buildDirectory.dir('https://s01.oss.sonatype.org/content/repositories/releases/')
//def snapshotsRepoUrl = layout.buildDirectory.dir('https://s01.oss.sonatype.org/content/repositories/snapshots/')

//TODO: is this actually the way to fully automatically do it?
//def releasesRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/releases/'
//def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
//url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl

//after publishing, go to https://s01.oss.sonatype.org, log in, close the staged repo, and release it if everything worked out
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
//uses keys and passwords declared in userhome/.gradle/gradle.properties
//username = property("ossrhUsername") as String
//password = property("ossrhPassword") as String
//uses environment variables declared in yml file which passes GitHub secrets to it
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}

signing {
//uses keys and passwords declared in userhome/.gradle/gradle.properties, works locally
//sign publishing.publications.mavenJava

//uses environment variables declared in yml file which passes GitHub secrets to it
def signingKey = System.getenv("signingKey")
def signingPassword = System.getenv("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
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-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit fdbb12f

Please sign in to comment.