Skip to content

Commit

Permalink
Configure deployment to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Feb 6, 2021
1 parent c3d2ff4 commit bd1cefc
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 10 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,21 +254,41 @@ java -jar jfxui/build/libs/jfxui.jar
./gradlew check -PuiTestsHeadless=false
```

#### <a name="building_release"></a>Building a release and deploy WebStart
#### Deployment

This will build a signed JAR and upload it to the AWS S3 bucket.
This will build WhiteRabbit, upload it to the AWS S3 bucket and publish the plugin api to Maven Central.

Precondition: initial setup of [keystore and AWS configuration](webstart/README.md).
#### Initial setup

1. Setup of [keystore and AWS configuration](webstart/README.md).
2. Add the following to your `~/.gradle/gradle.properties`:

```properties
ossrhUsername=<your maven central username>
ossrhPassword=<your maven central passwort>

signing.keyId=<gpg key id (last 8 chars)>
signing.password=<gpg key password>
signing.secretKeyRingFile=<path to secret keyring file>
```

#### Build and deploy

1. Make sure the [Changelog](CHANGELOG.md) is updated
2. Run the following command:

```bash
./gradlew clean build webstart:publishWebstart --info -PreleaseVersion=<version>
./gradlew clean build publish webstart:publishWebstart --info -PreleaseVersion=<version>
```

The release will be written to `jfxui/build/libs/white-rabbit-fx-<version>.jar` and the uploaded content will be available at [https://whiterabbit.chp1.net](https://whiterabbit.chp1.net).
The release will be written to `jfxui/build/libs/white-rabbit-fx-<version>.jar` and the uploaded content will be available at [https://whiterabbit.chp1.net](https://whiterabbit.chp1.net). Snapshots will be available at [https://oss.sonatype.org/content/repositories/snapshots/org/itsallcode/whiterabbit/](https://oss.sonatype.org/content/repositories/snapshots/org/itsallcode/whiterabbit/).

4. Release the artifacts at Maven Central:
1. Login at [oss.sonatype.org](https://oss.sonatype.org).
2. Go to the [staging repositories](https://oss.sonatype.org/#stagingRepositories).
3. Select repository named `orgitsallcode-*` and click the "Close" button.
4. When closing was successfull, click the "Release" button.
5. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/whiterabbit/).
3. Create a new [release](https://github.com/itsallcode/white-rabbit/releases) in GitHub and attach the built jar.

#### Managing WebStart configuration in a private branch
Expand Down
72 changes: 72 additions & 0 deletions api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
plugins {
id "java-library"
id "signing"
id "maven-publish"
}

java {
withJavadocJar()
withSourcesJar()
}

javadoc {
options.addBooleanOption('html5', true)
}

def getOptionalProperty(String name) {
if(project.hasProperty(name)) {
return project.property(name)
}
logger.info("Project property '${name}' not available. Please it to ~/.gradle/gradle.properties")
return null
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'whiterabbit-plugin-api'
from components.java
pom {
name = 'WhiteRabbit Plugin API'
description = 'API implemented by plugins for the WhiteRabbit time recording application'
url = 'https://github.com/itsallcode/white-rabbit'

licenses {
license {
name = 'GNU General Public License, Version 3.0'
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
}
}
developers {
developer {
id = 'kaklakariada'
name = 'Christoph'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/itsallcode/white-rabbit.git'
developerConnection = 'scm:git:https://github.com/itsallcode/white-rabbit.git'
url = 'https://github.com/itsallcode/white-rabbit'
}
}
}
}

repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
allowInsecureProtocol = false
credentials(PasswordCredentials) {
username = getOptionalProperty("ossrhUsername")
password = getOptionalProperty("ossrhPassword")
}
}
}
}

signing {
sign publishing.publications.mavenJava
}
10 changes: 7 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@ def getProjectVersion() {
if(project.hasProperty("releaseVersion")) {
return project.property("releaseVersion")
}
return "dev-SNAPSHOT"
return "1.4.0-SNAPSHOT"
}

version = getProjectVersion()
group = "org.itsallcode.whiterabbit"

def nonJavaProjects = ['webstart-infrastructure', 'webstart']

subprojects {
group = rootProject.group
version = rootProject.version

if(nonJavaProjects.contains(project.name)) {
return
}
apply plugin: "java"
apply plugin: "jacoco"

version = getProjectVersion()

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
Expand Down
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-6.8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ include 'plugins:pmsmart'

dependencyResolutionManagement {
repositories {
jcenter()
mavenCentral()
}
}

0 comments on commit bd1cefc

Please sign in to comment.