Skip to content

Configure OSSRH publishing to Maven Central #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

# This workflow will build a package using Gradle and then publish it to Sonatype OSSRH

name: Gradle Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2

- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'

- name: Build with Gradle
run: ./gradlew build

- name: Publish to Sonatype OSSRH
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Hat tip to [Mike Buhot](https://github.com/mbuhot) for the initial implementatio

```groovy
repositories {
jcenter()
mavenCentral()
}

dependencies {
compile("au.com.console:kotlin-jpa-specification-dsl:2.0.0")
compile("au.com.console:kotlin-jpa-specification-dsl:2.1.0")
}
```

Expand Down
33 changes: 8 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ plugins {
id 'nebula.release' version '14.0.2'
id 'nebula.kotlin' version '1.3.72'
id 'nebula.maven-publish' version '14.1.1'
id 'com.jfrog.bintray' version '1.8.4'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}

group 'au.com.console'

repositories {
jcenter()
mavenCentral()
}

sourceCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -35,28 +35,11 @@ test {
}
}

tasks.bintrayUpload.dependsOn tasks.check

gradle.taskGraph.whenReady { graph ->
tasks.bintrayUpload.onlyIf {
graph.hasTask(':final') || graph.hasTask(':candidate')
nexusPublishing {
repositories {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['nebula']
// allow republshing in case bintray fails to upload properly
override = true
pkg {
repo = 'kotlin'
userOrg = 'consoleau'
name = 'kotlin-jpa-specification-dsl'
licenses = ['Apache-2.0']
labels = ['kotlin','spring']
websiteUrl = "https://github.com/consoleau/${project.name}"
issueTrackerUrl = "https://github.com/consoleau/${project.name}/issues"
vcsUrl = "https://github.com/consoleau/${project.name}.git"
}
}