Skip to content

Commit d5423d7

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

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-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: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ 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
34+
version: 1.8
3335

3436
release:
3537
github:
@@ -62,11 +64,26 @@ release:
6264
replacers:
6365
- search: 'deps: '
6466

67+
signing:
68+
active: ALWAYS
69+
armored: true
70+
71+
deploy:
72+
maven:
73+
nexus2:
74+
maven-central:
75+
active: RELEASE
76+
url: https://s01.oss.sonatype.org/service/local
77+
closeRepository: true
78+
releaseRepository: true
79+
stagingRepositories:
80+
- build/repos/local/release
81+
6582
announce:
6683
twitter:
67-
active: release
84+
active: RELEASE
6885
status: 🚀 {{projectName}} {{projectVersion}} has been released! {{releaseNotesUrl}}
6986
mastodon:
70-
active: release
87+
active: RELEASE
7188
host: https://mastodon.social
7289
status: 🚀 {{projectName}} {{projectVersion}} has been released! {{releaseNotesUrl}}

0 commit comments

Comments
 (0)