Skip to content

Commit

Permalink
Prepare publish of com.gradleup.shadow (#930)
Browse files Browse the repository at this point in the history
- Plugin id from `com.github.johnrengelman.shadow` to `com.gradleup.shadow`.
- Support publishing to MavenCentral and with snapshots support.
- Add release workflows.
- Add changelog and releasing.
- Update original repo ref links.

---------

Co-authored-by: Alex Nordlund <[email protected]>
  • Loading branch information
Goooler and deepy authored Aug 8, 2024
1 parent b7d4d18 commit e652f1a
Show file tree
Hide file tree
Showing 28 changed files with 339 additions and 249 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: CI

on:
pull_request:
branches:
- main
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
Expand All @@ -25,3 +23,22 @@ jobs:
java-version: ${{ matrix.java }}
- uses: gradle/actions/setup-gradle@v4
- run: ./gradlew build

publish-snapshot:
needs: build
runs-on: ubuntu-latest
if: github.repository == 'GradleUp/shadow' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/actions/setup-gradle@v4
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 }}
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release

on:
push:
tags:
- '**'

jobs:
release:
runs-on: ubuntu-latest
if: github.repository == 'GradleUp/shadow'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: true
- uses: actions/setup-node
with:
# Due to some limitations of https://github.com/node-gradle/gradle-node-plugin.
node-version: '16'
# Disable CC due to https://github.com/gradle/gradle/issues/22779
- run: ./gradlew release --no-configuration-cache
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_SECRET }}
# https://ajoberstar.org/grgit/main/grgit-authentication.html#_environment_variables
GRGIT_USER: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }}
- name: Extract release notes
uses: ffurrer2/extract-release-notes@v2
with:
changelog_file: src/docs/changes/README.md
release_notes_file: RELEASE_NOTES.md
- name: Create release
run: gh release create ${{ github.ref_name }} --notes-file RELEASE_NOTES.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://oss.sonatype.org/)](https://oss.sonatype.org/content/repositories/snapshots/com/gradleup/shadow/)
[![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)

Expand All @@ -19,6 +21,7 @@ Read the [User Guide](https://imperceptiblethoughts.com/shadow/)!
| 5.x | 5.2.0 - 6.0.0 |
| 6.x | 5.2.0 - 6.1.0 |
| 7.x | 7.0.0+ |
| 8.x | 8.0.0+ |
| 8.0 - 8.2.x | 8.0.0 - 8.1.1 |
| 8.3+ | 8.3.0+ |

**NOTE**: Shadow v5.+ is compatible with Gradle 5.x - 6.x and Java 7 - 15 _only_, v6.1.0+ requires Java 8+.
40 changes: 40 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Releasing

1. Update the `VERSION_NAME` in `gradle.properties` to the release version.

2. Update the [changelog](src/docs/changes/README.md):
1. Change the `Unreleased` header to the release version.
2. Add a link URL to ensure the header link works.
3. Add a new `Unreleased` section to the top.

3. Update the `README.md` so the "Download" section reflects the new release version and the
snapshot section reflects the next "SNAPSHOT" version.

4. Commit

```
$ git commit -am "Prepare version X.Y.Z"
```

5. Tag

```
$ git tag -am "Version X.Y.Z" X.Y.Z
```

6. Update the `VERSION_NAME` in `gradle.properties` to the next "SNAPSHOT" version.

7. Commit

```
$ git commit -am "Prepare next development version"
```

8. Push!

```
$ git push && git push --tags
```

This will trigger a GitHub Action workflow which will create a GitHub release and upload the
release artifacts to Maven Central.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
28 changes: 27 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4g -XX:MaxMetaspaceSize=2g
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
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
RELEASE_SIGNING_ENABLED=true

POM_NAME=Shadow Gradle Plugin
POM_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.
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://[email protected]/GradleUp/shadow.git
POM_DEVELOPER_ID=gradleup
POM_DEVELOPER_NAME=GradleUp developers
POM_DEVELOPER_URL=https://github.com/GradleUp
9 changes: 1 addition & 8 deletions gradle/ghPages.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ import org.apache.tools.ant.filters.ReplaceTokens

apply plugin: 'org.ajoberstar.git-publish'

if (project.hasProperty('githubToken')) {
System.setProperty('org.ajoberstar.grgit.auth.username', project.property('githubToken') as String)
}

gitPublish {
repoUri = 'https://github.com/johnrengelman/shadow.git'
repoUri = 'https://github.com/GradleUp/shadow.git'

branch = 'gh-pages'

contents {
from 'build/site'
into('.circleci') {
from '.circleci'
}
into('api') {
from project.tasks.groovydoc
}
Expand Down
39 changes: 10 additions & 29 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
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").get()
version = providers.gradleProperty("VERSION_NAME").get()

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."
tags.set(['onejar', 'shade', 'fatjar', 'uberjar'])
displayName = providers.gradleProperty("POM_NAME").get()
description = providers.gradleProperty("POM_DESCRIPTION").get()
tags = ['onejar', 'shade', 'fatjar', 'uberjar']
}
}
}
Expand All @@ -35,18 +28,6 @@ tasks.named('publishPlugins') {
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')
dependsOn tasks.named('publish'), tasks.named('publishPlugins'), tasks.named('gitPublishPush')
}
1 change: 1 addition & 0 deletions gradle/vuepress.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ node {
tasks.named('yarn_build') {
inputs.files project.fileTree('src/docs')
outputs.dir project.file('build/site')
dependsOn("yarn")
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "shadow",
"version": "1.0.0",
"main": "index.js",
"repository": "[email protected]:johnrengelman/shadow.git",
"author": "John Engelman <[email protected]>",
"repository": "[email protected]:GradleUp/shadow.git",
"author": "GradleUp developers",
"license": "MIT",
"devDependencies": {
"prismjs": "^1.20.0",
Expand Down
12 changes: 0 additions & 12 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ develocity {
termsOfUseUrl = 'https://gradle.com/terms-of-service'
termsOfUseAgree = 'yes'
publishing.onlyIf { isCI }
if (isCI) {
tag 'CI'
if (System.env.CIRCLE_TAG) {
link 'VCS', "https://github.com/johnrengelman/shadow/tree/${System.env.CIRCLE_TAG}"
} else {
link 'VCS', "https://github.com/johnrengelman/shadow/tree/${System.env.CIRCLE_BRANCH}"
}
link 'VCS Commit', "https://github.com/johnrengelman/shadow/commit/${System.env.CIRCLE_SHA1}"
if (System.env.CI_PULL_REQUEST) {
link 'Pull Request', "${System.env.CI_PULL_REQUEST}"
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
dest: "build/site",
ga: "UA-321220-4",
themeConfig: {
repo: "johnrengelman/shadow",
repo: "GradleUp/shadow",
editLinks: true,
editLinkText: 'Help improve these docs!',
logo: '/logo+type.svg',
Expand Down
60 changes: 3 additions & 57 deletions src/docs/about/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,60 +22,6 @@ so Shadow was published there.

## Contributors

* [Alan D. Cabrera](https://github.com/maguro)
* [Andres Almiray](https://github.com/aalmiray)
* [Artem Chubaryan](https://github.com/Armaxis)
* [Attila Kelemen](https://github.com/kelemen)
* [Ben Adazza](https://github.com/ben-adazza)
* [Bernie Schelberg](https://github.com/bschelberg)
* [Brandon Kearby](https://github.com/brandonkearby)
* [Brane F. Gračnar](https://github.com/bfg)
* [Caleb Larsen](https://github.com/MuffinTheMan)
* [Charlie Knudsen](https://github.com/charliek)
* [Chris Cowan](https://github.com/Macil)
* [Chris Rankin](https://github.com/chrisr3)
* [Christian Stein](https://github.com/sormuras)
* [Daniel Oakey](https://github.com/danieloakey)
* [debanne](https://github.com/debanne)
* [Dennis Schumann](https://github.com/Hillkorn)
* [Dmitry Vyazelenko](https://github.com/vyazelenko)
* [ejjcase](https://github.com/ejjcase)
* [Ethan Hall](https://github.com/ethankhall)
* [Fedor Korotkov](https://github.com/fkorotkov)
* [Felipe Lima](https://github.com/felipecsl)
* [Gary Hale](https://github.com/ghale)
* [Haw-Bin Chai](https://github.com/hbchai)
* [Helder Pereira](https://github.com/helfper)
* [Inez Korczyński](https://github.com/inez)
* [James Nelson](https://github.com/JamesXNelson)
* [Jeff Adler](https://github.com/jeffalder)
* [John Szakmeister](https://github.com/jszakmeister)
* [Konstantin Gribov](https://github.com/grossws)
* [Lai Jiang](https://github.com/jianglai)
* [Marc Philipp](https://github.com/marcphilipp)
* [Mark Vieira](https://github.com/mark-vieira)
* [Marke Vieira](https://github.com/mark-vieira)
* [Martin Sadowski](https://github.com/ttsiebzehntt)
* [Matt Hurne](https://github.com/mhurne)
* [Matt King](https://github.com/kyrrigle)
* [Matthew Haughton](https://github.com/3flex)
* [Maximilian Müller](https://github.com/maxm123)
* [Minecrell](https://github.com/Minecrell)
* [Min-Ken Lai](https://github.com/minkenlai)
* [Nicolas Humblot](https://github.com/nhumblot)
* [Osip Fatkullin](https://github.com/osipxd)
* [Paul N. Baker](https://github.com/paul-nelson-baker)
* [Petar Petrov](https://github.com/petarov)
* [Piotr Kubowicz](https://github.com/pkubowicz)
* [Richard Marbach](https://github.com/RichardMarbach)
* [Rob Spieldenner](https://github.com/rspieldenner)
* [Roberto Perez Alcolea](https://github.com/rpalcolea)
* [Schalk W. Cronjé](https://github.com/ysb33r)
* [Scott Newson](https://github.com/sgnewson)
* [Serban Iordache](https://github.com/siordache)
* [Sergey Tselovalnikov](https://github.com/SerCeMan)
* [Tim Yates](https://github.com/timyates)
* [Trask Stalnaker](https://github.com/trask)
* [Tyler Benson](https://github.com/tylerbenson)
* [Victor Tso](https://github.com/roxchkplusony)
* [Yahor Berdnikau](https://github.com/Tapchicoma)
<a href="https://github.com/GradleUp/shadow/graphs/contributors">
<img src="https://contrib.rocks/image?repo=GradleUp/shadow" />
</a>
2 changes: 1 addition & 1 deletion src/docs/application-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading

0 comments on commit e652f1a

Please sign in to comment.