Skip to content

Commit

Permalink
Fix publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Jul 25, 2024
1 parent c5cf393 commit 5c322ce
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/287df22f683ed8422bc93deb9eb4a62099cc061f/src/actionsTemplate/resources/.github/workflows/build-prs.yml
# The template can be found at https://github.com/neoforged/GradleUtils/blob/72be0f55ce3f6e91f89cfd7847143b9ef1dcc3e9/src/actionsTemplate/resources/.github/workflows/build-prs.yml

name: Build and test PRs

Expand All @@ -20,4 +20,5 @@ jobs:
uses: neoforged/actions/.github/workflows/build-prs.yml@main
with:
java: 17
gradle_tasks: test
gradle_tasks: test
jar_compatibility: false
20 changes: 20 additions & 0 deletions .github/workflows/publish-jcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/72be0f55ce3f6e91f89cfd7847143b9ef1dcc3e9/src/actionsTemplate/resources/.github/workflows/publish-jcc.yml

name: Publish PR JCC output

on:
workflow_run:
workflows: [Build and test PRs]
types:
- completed

jobs:
publish-jcc:
if: false # Option not enabled when the workflows were generated
uses: neoforged/actions/.github/workflows/publish-jcc.yml@main
with:
beta_version_pattern: .* # Change this line if there's a clear point at which a version no longer accepts breaking changes
secrets:
JCC_GH_APP_ID: ${{ secrets.JCC_GH_APP_ID }}
JCC_GH_APP_KEY: ${{ secrets.JCC_GH_APP_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-prs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/287df22f683ed8422bc93deb9eb4a62099cc061f/src/actionsTemplate/resources/.github/workflows/publish-prs.yml
# The template can be found at https://github.com/neoforged/GradleUtils/blob/72be0f55ce3f6e91f89cfd7847143b9ef1dcc3e9/src/actionsTemplate/resources/.github/workflows/publish-prs.yml

name: Publish PRs to GitHub Packages

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/287df22f683ed8422bc93deb9eb4a62099cc061f/src/actionsTemplate/resources/.github/workflows/release.yml
# The template can be found at https://github.com/neoforged/GradleUtils/blob/72be0f55ce3f6e91f89cfd7847143b9ef1dcc3e9/src/actionsTemplate/resources/.github/workflows/release.yml

name: Release

Expand All @@ -17,12 +17,13 @@ jobs:
with:
java: 17
pre_gradle_tasks: test
gradle_tasks: publish
gradle_tasks: publish closeAndReleaseSonatypeStagingRepository
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_SUBKEY: ${{ secrets.GPG_SUBKEY }}
GPG_SUBKEY_ID: ${{ secrets.GPG_SUBKEY_ID }}
GPG_SUBKEY_PASSWORD: ${{ secrets.GPG_SUBKEY_PASSWORD }}

14 changes: 14 additions & 0 deletions api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import net.neoforged.gradleutils.PomUtilsExtension

plugins {
id 'java-library'
id 'maven-publish'
id 'net.neoforged.gradleutils'
}

Expand All @@ -8,6 +11,10 @@ group = 'net.neoforged.jst'
gradleutils {
setupSigning(project: project, signAllPublications: true)
}
java {
withSourcesJar()
withJavadocJar()
}

dependencies {
api "com.jetbrains.intellij.java:java-psi-impl:$intellij_version"
Expand All @@ -21,6 +28,13 @@ publishing {
artifactId = 'jst-api'

from components.java
pom {
name = 'JST API'
description = 'The JavaSourceTransformer API'
rootProject.pomUtils.githubRepo(it, 'JavaSourceTransformer')
rootProject.pomUtils.neoForgedDeveloper(it)
rootProject.pomUtils.license(it, PomUtilsExtension.License.LGPL_v2)
}
}
}
repositories {
Expand Down
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ plugins {
}

group = "net.neoforged.jst"
gradleutils.version {
branches.suffixBranch()
gradleutils {
setupCentralPublishing()
version {
branches.suffixBranch()
}
}
project.version = gradleutils.version

Expand Down
34 changes: 33 additions & 1 deletion cli/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import net.neoforged.gradleutils.PomUtilsExtension

plugins {
id 'java'
id 'com.github.johnrengelman.shadow'
Expand All @@ -14,6 +16,10 @@ jar {
}

gradleutils.setupSigning(project: project, signAllPublications: true)
java {
withSourcesJar()
withJavadocJar()
}

configurations {
shadow
Expand Down Expand Up @@ -52,19 +58,45 @@ components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElemen
skip()
}

tasks.register('sourcesBundleJar', Jar) {
it.archiveClassifier = 'sources'
it.archiveBaseName = 'jst-cli-bundle'
}
tasks.register('javadocBundleJar', Jar) {
it.archiveClassifier = 'javadoc'
it.archiveBaseName = 'jst-cli-bundle'
}

publishing {
publications {
// This publication only contains the unshaded jar with dependencies in the pom.xml
plain(MavenPublication) {
artifactId = 'jst-cli'

from components.java
pom {
name = 'JST CLI'
description = 'The JavaSourceTransformer CLI'
rootProject.pomUtils.githubRepo(it, 'JavaSourceTransformer')
rootProject.pomUtils.neoForgedDeveloper(it)
rootProject.pomUtils.license(it, PomUtilsExtension.License.LGPL_v2)
}
}
// This publication only contains the shaded standalone jar
bundle(MavenPublication) {
create('bundle', MavenPublication) {
artifactId = 'jst-cli-bundle'

project.shadow.component(bundle)
artifact(tasks.sourcesBundleJar)
artifact(tasks.javadocBundleJar)

pom {
name = 'JST CLI bundle'
description = 'The JavaSourceTransformer CLI bundle, containing all builtin plugins shadowed'
rootProject.pomUtils.githubRepo(it, 'JavaSourceTransformer')
rootProject.pomUtils.neoForgedDeveloper(it)
rootProject.pomUtils.license(it, PomUtilsExtension.License.LGPL_v2)
}
}
}
repositories {
Expand Down

0 comments on commit 5c322ce

Please sign in to comment.