Skip to content

Commit e652f1a

Browse files
Gooolerdeepy
andauthored
Prepare publish of com.gradleup.shadow (#930)
- 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]>
1 parent b7d4d18 commit e652f1a

File tree

28 files changed

+339
-249
lines changed

28 files changed

+339
-249
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
name: CI
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
74
push:
85
branches:
96
- main
7+
pull_request:
108
workflow_dispatch:
119

1210
jobs:
@@ -25,3 +23,22 @@ jobs:
2523
java-version: ${{ matrix.java }}
2624
- uses: gradle/actions/setup-gradle@v4
2725
- run: ./gradlew build
26+
27+
publish-snapshot:
28+
needs: build
29+
runs-on: ubuntu-latest
30+
if: github.repository == 'GradleUp/shadow' && github.ref == 'refs/heads/main'
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions/setup-java@v4
34+
with:
35+
distribution: 'zulu'
36+
java-version: 21
37+
- uses: gradle/actions/setup-gradle@v4
38+
with:
39+
cache-read-only: true
40+
# Disable CC due to https://github.com/gradle/gradle/issues/22779
41+
- run: ./gradlew publish --no-configuration-cache
42+
env:
43+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USER }}
44+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '**'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
if: github.repository == 'GradleUp/shadow'
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-java@v4
17+
with:
18+
distribution: 'zulu'
19+
java-version: 21
20+
- uses: gradle/actions/setup-gradle@v4
21+
with:
22+
cache-read-only: true
23+
- uses: actions/setup-node
24+
with:
25+
# Due to some limitations of https://github.com/node-gradle/gradle-node-plugin.
26+
node-version: '16'
27+
# Disable CC due to https://github.com/gradle/gradle/issues/22779
28+
- run: ./gradlew release --no-configuration-cache
29+
env:
30+
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_KEY }}
31+
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_SECRET }}
32+
# https://ajoberstar.org/grgit/main/grgit-authentication.html#_environment_variables
33+
GRGIT_USER: ${{ secrets.GITHUB_TOKEN }}
34+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USER }}
35+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
36+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
37+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }}
38+
- name: Extract release notes
39+
uses: ffurrer2/extract-release-notes@v2
40+
with:
41+
changelog_file: src/docs/changes/README.md
42+
release_notes_file: RELEASE_NOTES.md
43+
- name: Create release
44+
run: gh release create ${{ github.ref_name }} --notes-file RELEASE_NOTES.md
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Read the [User Guide](https://imperceptiblethoughts.com/shadow/)!
88

99
## Current Status
1010

11-
[![Download](https://img.shields.io/gradle-plugin-portal/v/com.github.johnrengelman.shadow)](https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow)
11+
[![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)
12+
[![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/)
13+
[![Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.gradleup.shadow)](https://plugins.gradle.org/plugin/com.gradleup.shadow)
1214
[![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)
1315
[![License](https://img.shields.io/github/license/GradleUp/shadow.svg)](LICENSE)
1416

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

2427
**NOTE**: Shadow v5.+ is compatible with Gradle 5.x - 6.x and Java 7 - 15 _only_, v6.1.0+ requires Java 8+.

RELEASING.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Releasing
2+
3+
1. Update the `VERSION_NAME` in `gradle.properties` to the release version.
4+
5+
2. Update the [changelog](src/docs/changes/README.md):
6+
1. Change the `Unreleased` header to the release version.
7+
2. Add a link URL to ensure the header link works.
8+
3. Add a new `Unreleased` section to the top.
9+
10+
3. Update the `README.md` so the "Download" section reflects the new release version and the
11+
snapshot section reflects the next "SNAPSHOT" version.
12+
13+
4. Commit
14+
15+
```
16+
$ git commit -am "Prepare version X.Y.Z"
17+
```
18+
19+
5. Tag
20+
21+
```
22+
$ git tag -am "Version X.Y.Z" X.Y.Z
23+
```
24+
25+
6. Update the `VERSION_NAME` in `gradle.properties` to the next "SNAPSHOT" version.
26+
27+
7. Commit
28+
29+
```
30+
$ git commit -am "Prepare next development version"
31+
```
32+
33+
8. Push!
34+
35+
```
36+
$ git push && git push --tags
37+
```
38+
39+
This will trigger a GitHub Action workflow which will create a GitHub release and upload the
40+
release artifacts to Maven Central.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ plugins {
66
id 'project-report'
77
id 'idea'
88
id 'java-gradle-plugin'
9-
id 'signing'
109
id 'com.gradle.plugin-publish' version '1.2.1'
1110
id 'org.ajoberstar.git-publish' version '4.2.2'
1211
id 'com.github.node-gradle.node' version '7.0.2'
12+
id 'com.vanniktech.maven.publish' version "0.29.0"
1313
}
1414

1515
apply plugin: ShadowPlugin
@@ -32,7 +32,7 @@ tasks.withType(Test).configureEach {
3232
maxHeapSize "1g"
3333
}
3434

35-
systemProperty 'java.io.tmpdir', project.layout.buildDirectory.asFile.get().absolutePath
35+
systemProperty 'shadowVersion', version
3636

3737
// Required to test configuration cache in tests when using withDebug()
3838
// https://github.com/gradle/gradle/issues/22765#issuecomment-1339427241

gradle.properties

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
11
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4g -XX:MaxMetaspaceSize=2g
22
org.gradle.parallel=true
33
org.gradle.caching=true
4-
org.gradle.configuration-cache=true
4+
org.gradle.configuration-cache=true
5+
6+
7+
GROUP=com.gradleup.shadow
8+
POM_ARTIFACT_ID=shadow-gradle-plugin
9+
VERSION_NAME=8.3.0-SNAPSHOT
10+
11+
SONATYPE_AUTOMATIC_RELEASE=true
12+
SONATYPE_HOST=DEFAULT
13+
RELEASE_SIGNING_ENABLED=true
14+
15+
POM_NAME=Shadow Gradle Plugin
16+
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.
17+
POM_INCEPTION_YEAR=2024
18+
POM_URL=https://github.com/GradleUp/shadow
19+
20+
POM_LICENSE_NAME=The Apache Software License, Version 2.0
21+
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
22+
POM_LICENSE_DIST=repo
23+
24+
POM_SCM_URL=https://github.com/GradleUp/shadow
25+
POM_SCM_CONNECTION=scm:git:git://github.com/GradleUp/shadow.git
26+
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/GradleUp/shadow.git
27+
28+
POM_DEVELOPER_ID=gradleup
29+
POM_DEVELOPER_NAME=GradleUp developers
30+
POM_DEVELOPER_URL=https://github.com/GradleUp

gradle/ghPages.gradle

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,13 @@ import org.apache.tools.ant.filters.ReplaceTokens
22

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

5-
if (project.hasProperty('githubToken')) {
6-
System.setProperty('org.ajoberstar.grgit.auth.username', project.property('githubToken') as String)
7-
}
8-
95
gitPublish {
10-
repoUri = 'https://github.com/johnrengelman/shadow.git'
6+
repoUri = 'https://github.com/GradleUp/shadow.git'
117

128
branch = 'gh-pages'
139

1410
contents {
1511
from 'build/site'
16-
into('.circleci') {
17-
from '.circleci'
18-
}
1912
into('api') {
2013
from project.tasks.groovydoc
2114
}

gradle/publish.gradle

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
apply plugin: "com.gradle.plugin-publish"
2+
apply plugin: "com.vanniktech.maven.publish"
23

3-
group = 'com.github.johnrengelman'
4-
5-
if (System.env.CIRCLE_TAG && System.env.CIRCLE_TAG =~ /^\d\.\d\.\d$/) {
6-
version = System.env.CIRCLE_TAG
7-
} else {
8-
version = file('src/main/resources/shadow-version.txt').text.trim()
9-
if (!version.endsWith("-SNAPSHOT")) {
10-
version = version + "-SNAPSHOT"
11-
}
12-
}
4+
group = providers.gradleProperty("GROUP").get()
5+
version = providers.gradleProperty("VERSION_NAME").get()
136

147
gradlePlugin {
15-
website = 'https://github.com/johnrengelman/shadow'
16-
vcsUrl = 'https://github.com/johnrengelman/shadow'
8+
website = providers.gradleProperty("POM_URL")
9+
vcsUrl = providers.gradleProperty("POM_URL")
1710

1811
plugins {
1912
shadowPlugin {
20-
id = 'com.github.johnrengelman.shadow'
13+
id = 'com.gradleup.shadow'
2114
implementationClass = 'com.github.jengelman.gradle.plugins.shadow.ShadowPlugin'
22-
displayName = 'Shadow Plugin'
23-
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."
24-
tags.set(['onejar', 'shade', 'fatjar', 'uberjar'])
15+
displayName = providers.gradleProperty("POM_NAME").get()
16+
description = providers.gradleProperty("POM_DESCRIPTION").get()
17+
tags = ['onejar', 'shade', 'fatjar', 'uberjar']
2518
}
2619
}
2720
}
@@ -35,18 +28,6 @@ tasks.named('publishPlugins') {
3528
notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/21283")
3629
}
3730

38-
signing {
39-
if (System.env.CI == 'true') {
40-
def encodedSigningKey = findProperty("signingKey")
41-
def signingKey = encodedSigningKey ? new String(encodedSigningKey.decodeBase64()) : null
42-
def signingPassword = findProperty("signingPassword") as String
43-
useInMemoryPgpKeys(signingKey, signingPassword)
44-
}
45-
// See https://github.com/johnrengelman/shadow/pull/831#discussion_r1119012328
46-
required = false && gradle.taskGraph.hasTask("artifactoryPublish")
47-
sign(publishing.publications)
48-
}
49-
5031
tasks.register('release') {
51-
dependsOn tasks.named('assemble'), tasks.named('publishPlugins'), tasks.named('gitPublishPush')
32+
dependsOn tasks.named('publish'), tasks.named('publishPlugins'), tasks.named('gitPublishPush')
5233
}

gradle/vuepress.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ node {
77
tasks.named('yarn_build') {
88
inputs.files project.fileTree('src/docs')
99
outputs.dir project.file('build/site')
10+
dependsOn("yarn")
1011
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "shadow",
33
"version": "1.0.0",
44
"main": "index.js",
5-
"repository": "[email protected]:johnrengelman/shadow.git",
6-
"author": "John Engelman <[email protected]>",
5+
"repository": "[email protected]:GradleUp/shadow.git",
6+
"author": "GradleUp developers",
77
"license": "MIT",
88
"devDependencies": {
99
"prismjs": "^1.20.0",

0 commit comments

Comments
 (0)