Skip to content

Commit

Permalink
Fix publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Nov 29, 2023
1 parent b041248 commit a6fe11b
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 188 deletions.
30 changes: 9 additions & 21 deletions .github/workflows/build-prs.yml
Expand Up @@ -7,26 +7,14 @@ on:
- opened
- ready_for_review
- reopened
push:
branches:
- 'feature/**'
workflow_dispatch:

jobs:
jdk17:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 1000
fetch-tags: true

- name: Setup JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
build:
uses: neoforged/actions/.github/workflows/build-prs.yml@main
with:
java: 17
gradle_tasks: test
16 changes: 7 additions & 9 deletions .github/workflows/release.yml
Expand Up @@ -9,20 +9,18 @@ permissions:
statuses: write

jobs:
build:
release:
uses: neoforged/actions/.github/workflows/gradle-publish.yml@main
with:
java: 17
pre_gradle_tasks: ':bus-test:test'
gradle_tasks: ':publish closeAndReleaseSonatypeStagingRepository'
pre_gradle_tasks: test
gradle_tasks: publish closeAndReleaseSonatypeStagingRepository
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

GPG_SUBKEY: ${{ secrets.GPG_SUBKEY }}
GPG_SUBKEY_ID: ${{ secrets.GPG_SUBKEY_ID }}
GPG_SUBKEY_PASSWORD: ${{ secrets.GPG_SUBKEY_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
73 changes: 20 additions & 53 deletions build.gradle
@@ -1,17 +1,22 @@
import net.neoforged.gradleutils.PomUtilsExtension

buildscript {
dependencies {
classpath('de.jjohannes.gradle:extra-java-module-info:0.14')
}
}
plugins {
id 'signing'
id 'net.neoforged.gradleutils' version '[2.0.18,)'
id 'net.neoforged.gradleutils' version '3.0.0-alpha.5'
id 'com.github.ben-manes.versions' version '0.42.0'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
id 'net.neoforged.licenser' version '0.7.2' apply false
}
apply plugin: 'maven-publish'

gradleutils {
setupCentralPublishing()
setupSigning(signAllPublications: true)
}

allprojects {
apply plugin: 'java-library'
apply plugin: 'eclipse'
Expand All @@ -23,7 +28,12 @@ allprojects {
toolchain.languageVersion = JavaLanguageVersion.of(17)
modularity.inferModulePath.set(true)
}
version = gradleutils.getTagOffsetVersion()
gradleutils {
version {
branches.suffixBranch.set(true)
}
}
version = gradleutils.version

repositories {
mavenLocal()
Expand Down Expand Up @@ -73,7 +83,7 @@ allprojects {
}

changelog {
fromTag '7.0'
from '7.0'
}

logger.lifecycle('Version: ' + version)
Expand All @@ -86,7 +96,6 @@ ext.sharedManifest = manifest {
'Implementation-Title': project.name,
'Implementation-Version': "${project.version}+${gradleutils.gitInfo.branch}.${gradleutils.gitInfo.abbreviatedId}",
'Implementation-Vendor' :'NeoForged',
'Implementation-Timestamp': java.time.Instant.now().toString(),
'Git-Commit': gradleutils.gitInfo.abbreviatedId,
'Git-Branch': gradleutils.gitInfo.branch,
] as LinkedHashMap, 'net/neoforged/bus/service/')
Expand All @@ -107,62 +116,20 @@ dependencies {
api('net.jodah:typetools:0.6.3')
}

nexusPublishing {
repositories {
sonatype {
username.set(System.getenv('SONATYPE_USER') ?: '')
password.set(System.getenv('SONATYPE_PASSWORD') ?: '')
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'Bus'
description = 'High performance Event Bus library'
url = 'https://github.com/neoforged/bus'
scm {
url = 'https://github.com/neoforged/bus'
connection = 'scm:git:git://github.com/neoforged/bus.git'
developerConnection = 'scm:git:git@github.com:neoforged/bus.git'
}
issueManagement {
system = 'github'
url = 'https://github.com/neoforged/bus/issues'
}

licenses {
license {
name = 'LGPLv2.1'
url = 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt'
}
}

developers {
developer {
id = 'neoforged'
name = 'NeoForged'
email = 'contact@neoforged.net'
url = 'https://github.com/NeoForged/'
}
}
pomUtils.githubRepo(it, 'Bus')
pomUtils.neoForgedDeveloper(it)
pomUtils.license(it, PomUtilsExtension.License.LGPL_v2)
}
}
}
repositories {
maven gradleutils.getPublishingForgeMaven()
maven gradleutils.publishingMaven
}
}

if (System.getenv('GPG_PRIVATE_KEY')) {
signing {
final signingKey = System.getenv('GPG_PRIVATE_KEY') ?: ''
final signingPassword = System.getenv('GPG_KEY_PASSWORD') ?: ''
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit a6fe11b

Please sign in to comment.