Skip to content

Commit

Permalink
Feedback on plugin rework
Browse files Browse the repository at this point in the history
  • Loading branch information
jdaugherty committed Dec 3, 2024
1 parent c9bc9a2 commit 5d2869e
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 102 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
strategy:
matrix:
java: ['17', '21']
env:
WORKSPACE: ${{ github.workspace }}
steps:
- name: "📥 Checkout repository"
uses: actions/checkout@v4
Expand Down Expand Up @@ -86,7 +84,7 @@ jobs:
env:
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: ./gradle groovydoc
run: ./gradlew groovydoc
- name: "🚀 Publish to Github Pages"
id: docs
if: success()
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
SECRING_FILE: ${{ secrets.SECRING_FILE }}
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: |
run: >
./gradlew
-Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg
publishToSonatype
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
run: |
run: >
./gradlew
findSonatypeStagingRepository
releaseSonatypeStagingRepository
Expand Down Expand Up @@ -135,6 +135,10 @@ jobs:
with:
distribution: liberica
java-version: 17
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: "📜 Generate Groovydoc"
id: groovydoc
env:
Expand Down
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ _Todo_: Add the docs

grails-publish
---------
A Gradle plugin to simplify publishing:

1. snapshots with either the Maven Publish gradle plugin or Nexus Publish gradle plugin.
2. releases with the Nexus Publish gradle plugin.
A Gradle plugin to ease publishing with the maven publish plugin or the nexus publish plugin.

Example Usage:

Expand Down Expand Up @@ -74,23 +71,23 @@ or
developers = [johndoe: 'John Doe']
}

By default this plugin will publish to the specified `MAVEN_PUBLISH` instance for snapshots, and `NEXUS_PUBLISH` for releases. To change the snapshot publish behavior, you can set the `snapshotRepoType` to `RepositoryTarget.NEXUS_PUBLISH`.
By default this plugin will publish to the specified `MAVEN_PUBLISH` instance for snapshots, and `NEXUS_PUBLISH` for releases. To change the snapshot publish behavior, set `snapshotRepoType` to `PublishType.NEXUS_PUBLISH`. To change the release publish behavior, set `releaseRepoType` to `PublishType.NEXUS_PUBLISH`.

The credentials and connection url must be specified as a project property or an environment variable.

The `MAVEN_PUBLISH` Environment Variables are:
`MAVEN_PUBLISH` Environment Variables are:

ARTIFACTORY_USERNAME
ARTIFACTORY_PASSWORD
ARTIFACTORY_URL
MAVEN_PUBLISH_USERNAME
MAVEN_PUBLISH_PASSWORD
MAVEN_PUBLISH_URL

The `NEXUS_PUBLISH` Environment Variables are:
`NEXUS_PUBLISH` Environment Variables are:

SONATYPE_NEXUS_URL
SONATYPE_SNAPSHOT_URL
SONATYPE_USERNAME
SONATYPE_PASSWORD
SONATYPE_STAGING_PROFILE_ID
NEXUS_PUBLISH_URL
NEXUS_PUBLISH_SNAPSHOT_URL
NEXUS_PUBLISH_USERNAME
NEXUS_PUBLISH_PASSWORD
NEXUS_PUBLISH_STAGING_PROFILE_ID

grails-web
---------
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ buildCache {
}


rootProject.name = "grails-gradle-plugin"
rootProject.name = 'grails-gradle-plugin'
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.gradle.api.XmlProvider
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.DependencySet
import org.gradle.api.artifacts.SelfResolvingDependency
import org.gradle.api.publish.maven.MavenPom
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
import org.grails.gradle.plugin.publishing.GrailsPublishGradlePlugin
Expand All @@ -43,13 +44,13 @@ class GrailsProfilePublishGradlePlugin extends GrailsPublishGradlePlugin {
@Override
void apply(Project project) {
super.apply(project)
final File tempReadmeForJavadoc = Files.createTempFile("README", "txt").toFile()
tempReadmeForJavadoc << "https://central.sonatype.org/publish/requirements/#supply-javadoc-and-sources"
project.tasks.create("javadocJar", Jar, { Jar jar ->
final File tempReadmeForJavadoc = Files.createTempFile('README', 'txt').toFile()
tempReadmeForJavadoc << 'https://central.sonatype.org/publish/requirements/#supply-javadoc-and-sources'
project.tasks.create('javadocJar', Jar, { Jar jar ->
jar.from(tempReadmeForJavadoc)
jar.archiveClassifier.set("javadoc")
jar.destinationDirectory.set(new File(project.layout.buildDirectory.getAsFile().get(), "libs"))
jar.setDescription("Assembles a jar archive containing the profile javadoc.")
jar.archiveClassifier.set('javadoc')
jar.destinationDirectory.set(new File(project.layout.buildDirectory.getAsFile().get(), 'libs'))
jar.setDescription('Assembles a jar archive containing the profile javadoc.')
jar.setGroup(BUILD_GROUP)
})
}
Expand All @@ -68,10 +69,10 @@ class GrailsProfilePublishGradlePlugin extends GrailsPublishGradlePlugin {

@Override
protected void doAddArtefact(Project project, MavenPublication publication) {
publication.artifact(project.tasks.findByName("jar"))
publication.pom(new Action<org.gradle.api.publish.maven.MavenPom>() {
publication.artifact(project.tasks.findByName('jar'))
publication.pom(new Action<MavenPom>() {
@Override
void execute(org.gradle.api.publish.maven.MavenPom mavenPom) {
void execute(MavenPom mavenPom) {
mavenPom.withXml(new Action<XmlProvider>() {
@Override
void execute(XmlProvider xml) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ import org.gradle.util.ConfigureUtil

/**
* @author Puneet Behl
* @author James Daugherty
* @since 4.0.11
*/
@CompileStatic
class GrailsPublishExtension {
/**
* Determines the snapshot repository to publish to
* Determines which plugin is used to publish snapshots
*/
RepositoryTarget snapshotRepoType = RepositoryTarget.MAVEN_PUBLISH
PublishType snapshotPublishType = PublishType.MAVEN_PUBLISH

/**
* Determines which plugin is used to publish releases
*/
PublishType releasePublishType = PublishType.NEXUS_PUBLISH

/**
* The slug from github
Expand Down
Loading

0 comments on commit 5d2869e

Please sign in to comment.