Skip to content

Commit d2af9c1

Browse files
committed
build: Configure deployment to Maven Central with JReleaser
1 parent 33ac86c commit d2af9c1

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,11 @@ jobs:
5555
git commit -a -m "Releasing version $VERSION"
5656
git push origin master
5757
58-
- name: Deploy to Plugin Portal and Maven Central
58+
- name: Deploy to Plugin Portal and stage artifacts
5959
env:
60-
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
61-
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
62-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
6360
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
6461
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
65-
run: ./gradlew -Prelease=true -Pfull-release=true :enforcer-api:publishToSonatype :enforcer-rules:publishToSonatype publishPlugins -S
62+
run: ./gradlew -Pprofile=release publishPlugins publish cleanupStagedRepository -S
6663

6764
- name: Release
6865
uses: jreleaser/release-action@v2
@@ -79,6 +76,9 @@ jobs:
7976
JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
8077
JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
8178
JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
79+
JRELEASER_MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
80+
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
81+
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
8282

8383
- name: JReleaser output
8484
if: always()

build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,14 @@ subprojects {
100100
resolutionStrategy.force "org.apache.commons:commons-lang3:$commonsLang3Version"
101101
}
102102
}
103+
104+
// Delete Gradle artifacts not suitable for publication to Maven Central
105+
tasks.register('cleanupStagedRepository') {
106+
doLast {
107+
def repoDir = project.layout.buildDirectory.dir('repos/local/release/org/kordamp/gradle').get()
108+
repoDir.dir('enforcer-gradle-plugin').asFile.deleteDir()
109+
repoDir.dir('enforcer').asFile.deleteDir()
110+
repoDir.dir('project-enforcer').asFile.deleteDir()
111+
repoDir.dir('org.kordamp.gradle.enforcer.gradle.plugin').asFile.deleteDir()
112+
}
113+
}

jreleaser.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ project:
2828
authors:
2929
- Andres Almiray
3030
license: Apache-2.0
31-
extraProperties:
32-
inceptionYear: 2020
31+
inceptionYear: 2020
32+
java:
33+
groupId: org.kordamp.gradle
3334

3435
release:
3536
github:
@@ -62,11 +63,26 @@ release:
6263
replacers:
6364
- search: 'deps: '
6465

66+
signing:
67+
active: ALWAYS
68+
armored: true
69+
70+
deploy:
71+
maven:
72+
nexus2:
73+
maven-central:
74+
active: RELEASE
75+
url: https://s01.oss.sonatype.org/service/local
76+
closeRepository: true
77+
releaseRepository: true
78+
stagingRepositories:
79+
- build/repos/local/release
80+
6581
announce:
6682
twitter:
67-
active: release
83+
active: RELEASE
6884
status: 🚀 {{projectName}} {{projectVersion}} has been released! {{releaseNotesUrl}}
6985
mastodon:
70-
active: release
86+
active: RELEASE
7187
host: https://mastodon.social
7288
status: 🚀 {{projectName}} {{projectVersion}} has been released! {{releaseNotesUrl}}

0 commit comments

Comments
 (0)