diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac0b62e8a..5762fd31b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,10 @@ name: CI on: - pull_request: - branches: - - main push: branches: - main + pull_request: workflow_dispatch: jobs: @@ -28,3 +26,23 @@ jobs: gradle-home-cache-cleanup: true validate-wrappers: true - run: ./gradlew build + + publish-snapshot: + needs: build + runs-on: ubuntu-latest + # I'll add github.ref == 'refs/heads/main' check before merging this PR. + if: github.repository == 'GradleUp/shadow' + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + - uses: gradle/actions/setup-gradle@v3 + with: + cache-read-only: true + # Disable CC due to https://github.com/gradle/gradle/issues/22779 + - run: ./gradlew publish --no-configuration-cache + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USER }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..0f810f553 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + tags: + - '**' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + - uses: gradle/actions/setup-gradle@v3 + with: + cache-read-only: true + - run: ./gradlew publish + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USER }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }} diff --git a/README.md b/README.md index 2b376279c..e896e8fcf 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ Read the [User Guide](https://imperceptiblethoughts.com/shadow/)! ## Current Status -[![Download](https://img.shields.io/gradle-plugin-portal/v/com.github.johnrengelman.shadow)](https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow) +[![Maven Central](https://img.shields.io/maven-central/v/com.gradleup.shadow/shadow-gradle-plugin)](https://central.sonatype.com/artifact/com.gradleup.shadow/shadow-gradle-plugin) +[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.gradleup.shadow/shadow-gradle-plugin?&server=https://s01.oss.sonatype.org/)](https://s01.oss.sonatype.org/content/repositories/snapshots/io/github/GradleUp/shadow/shadow-gradle-plugin) +[![Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.gradleup.shadow)](https://plugins.gradle.org/plugin/com.gradleup.shadow) [![CI](https://github.com/GradleUp/shadow/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/GradleUp/shadow/actions/workflows/ci.yml?query=branch:main+event:push) [![License](https://img.shields.io/github/license/GradleUp/shadow.svg)](LICENSE) diff --git a/build.gradle b/build.gradle index edc61af78..a184c9e77 100644 --- a/build.gradle +++ b/build.gradle @@ -6,10 +6,10 @@ plugins { id 'project-report' id 'idea' id 'java-gradle-plugin' - id 'signing' id 'com.gradle.plugin-publish' version '1.2.1' id 'org.ajoberstar.git-publish' version '4.2.2' id 'com.github.node-gradle.node' version '7.0.2' + id 'com.vanniktech.maven.publish' version "0.29.0" } apply plugin: ShadowPlugin @@ -32,7 +32,7 @@ tasks.withType(Test).configureEach { maxHeapSize "1g" } - systemProperty 'java.io.tmpdir', project.layout.buildDirectory.asFile.get().absolutePath + systemProperty 'shadowVersion', version // Required to test configuration cache in tests when using withDebug() // https://github.com/gradle/gradle/issues/22765#issuecomment-1339427241 diff --git a/gradle.properties b/gradle.properties index 07462a044..640f0391f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,29 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4g -XX:MaxMetaspaceSize=2g org.gradle.parallel=true org.gradle.caching=true -org.gradle.configuration-cache=true \ No newline at end of file +org.gradle.configuration-cache=true + + +GROUP=com.gradleup.shadow +POM_ARTIFACT_ID=shadow-gradle-plugin +VERSION_NAME=8.3.0-SNAPSHOT + +SONATYPE_AUTOMATIC_RELEASE=true +SONATYPE_HOST=DEFAULT + +POM_NAME=Shadow Gradle Plugin +POM_DESCRIPTION=Gradle version of Maven's Shade plugin. +POM_INCEPTION_YEAR=2024 +POM_URL=https://github.com/GradleUp/shadow + +POM_LICENSE_NAME=The Apache Software License, Version 2.0 +POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENSE_DIST=repo + +POM_SCM_URL=https://github.com/GradleUp/shadow +POM_SCM_CONNECTION=scm:git:git://github.com/GradleUp/shadow.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/GradleUp/shadow.git + +POM_DEVELOPER_ID=gradleup +POM_DEVELOPER_NAME=GradleUp developers +POM_DEVELOPER_URL=https://github.com/GradleUp \ No newline at end of file diff --git a/gradle/publish.gradle b/gradle/publish.gradle index 921c89c69..5ef836132 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -1,52 +1,28 @@ apply plugin: "com.gradle.plugin-publish" +apply plugin: "com.vanniktech.maven.publish" -group = 'com.github.johnrengelman' - -if (System.env.CIRCLE_TAG && System.env.CIRCLE_TAG =~ /^\d\.\d\.\d$/) { - version = System.env.CIRCLE_TAG -} else { - version = file('src/main/resources/shadow-version.txt').text.trim() - if (!version.endsWith("-SNAPSHOT")) { - version = version + "-SNAPSHOT" - } -} +group = providers.gradleProperty("GROUP") +version = providers.gradleProperty("VERSION_NAME") gradlePlugin { - website = 'https://github.com/johnrengelman/shadow' - vcsUrl = 'https://github.com/johnrengelman/shadow' + website = providers.gradleProperty("POM_URL") + vcsUrl = providers.gradleProperty("POM_URL") plugins { shadowPlugin { - id = 'com.github.johnrengelman.shadow' + id = 'com.gradleup.shadow' implementationClass = 'com.github.jengelman.gradle.plugins.shadow.ShadowPlugin' - displayName = 'Shadow Plugin' - description = "Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin." + displayName = providers.gradleProperty("POM_NAME").orNull + description = providers.gradleProperty("POM_DESCRIPTION").orNull tags.set(['onejar', 'shade', 'fatjar', 'uberjar']) } } } tasks.named('publishPlugins') { - doFirst { - if (version.endsWith("SNAPSHOT")) { - throw new GradleException('Cannot publish SNAPSHOT versions to Plugin Portal!') - } - } notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/21283") } -signing { - if (System.env.CI == 'true') { - def encodedSigningKey = findProperty("signingKey") - def signingKey = encodedSigningKey ? new String(encodedSigningKey.decodeBase64()) : null - def signingPassword = findProperty("signingPassword") as String - useInMemoryPgpKeys(signingKey, signingPassword) - } - // See https://github.com/johnrengelman/shadow/pull/831#discussion_r1119012328 - required = false && gradle.taskGraph.hasTask("artifactoryPublish") - sign(publishing.publications) -} - -tasks.register('release') { - dependsOn tasks.named('assemble'), tasks.named('publishPlugins'), tasks.named('gitPublishPush') +mavenPublishing { + signAllPublications() } diff --git a/src/docs/application-plugin/README.md b/src/docs/application-plugin/README.md index 896e222a9..e365fb198 100644 --- a/src/docs/application-plugin/README.md +++ b/src/docs/application-plugin/README.md @@ -11,7 +11,7 @@ configured to contain the `Main-Class` attribute with the value specified in the // Using Shadow with Application Plugin apply plugin: 'java' apply plugin: 'application' -apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'com.gradleup.shadow' application { mainClass = 'myapp.Main' diff --git a/src/docs/changes/README.md b/src/docs/changes/README.md index 25068614d..29fcfbd1d 100644 --- a/src/docs/changes/README.md +++ b/src/docs/changes/README.md @@ -65,7 +65,7 @@ Instead, use the `enableRelocation = true` and `relocationPrefix = "