Skip to content
Closed
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
56 changes: 37 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,58 @@
name: Publish to OSS Sonatype
name: Publish to Maven Central

on:
release:
types: [ created ]
workflow_dispatch:
inputs:
dry-run:
description: 'Run in dry-run mode (no actual publish)'
required: true
default: true
type: boolean

jobs:
publish:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
contents: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v4

- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
run: ./gradlew build

- name: Publish to staging
run: ./gradlew publishAllPublicationsToStagingRepository

- name: Publish to maven central
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
- name: Deploy with JReleaser
uses: jreleaser/release-action@v2
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
arguments: deploy ${{ inputs.dry-run && '--dry-run' || '' }}
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
JRELEASER_MAVENCENTRAL_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload JReleaser logs
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-logs
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
28 changes: 8 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
*/

plugins {
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
id 'me.qoomon.git-versioning' version '6.4.1'
id 'java'
id 'maven-publish'
id 'signing'
}

repositories {
Expand Down Expand Up @@ -59,14 +57,6 @@ test {
useJUnitPlatform()
}

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/'))
}
}
}

publishing {
publications {
Expand Down Expand Up @@ -97,21 +87,19 @@ publishing {
}

scm {
connection = 'https://github.com/deblockt/json-diff.git'
developerConnection = 'https://github.com/deblockt/json-diff.git'
connection = 'scm:git:https://github.com/deblockt/json-diff.git'
developerConnection = 'scm:git:ssh://github.com/deblockt/json-diff.git'
url = 'https://github.com/deblockt/json-diff'
}
}
}
}

signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
if (signingKey !== null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
repositories {
maven {
name = 'staging'
url = layout.buildDirectory.dir('staging-deploy')
}

sign publishing.publications.mavenJava
}
}
}

21 changes: 21 additions & 0 deletions jreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
project:
name: json-diff
description: A customizable lib to perform a json-diff
links:
homepage: https://github.com/deblockt/json-diff
authors:
- Thomas Deblock
license: Apache-2.0
inceptionYear: "2022"

signing:
active: ALWAYS
armored: true

deploy:
maven:
mavenCentral:
sonatype:
active: ALWAYS
url: https://central.sonatype.com/api/v1/publisher
stagingRepository: build/staging-deploy
Loading