Skip to content

Commit

Permalink
build: Configure deployment to Maven Central with JReleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Nov 28, 2022
1 parent 33ac86c commit d5423d7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,11 @@ jobs:
git commit -a -m "Releasing version $VERSION"
git push origin master
- name: Deploy to Plugin Portal and Maven Central
- name: Deploy to Plugin Portal and stage artifacts
env:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
run: ./gradlew -Prelease=true -Pfull-release=true :enforcer-api:publishToSonatype :enforcer-rules:publishToSonatype publishPlugins -S
run: ./gradlew -Pprofile=release publishPlugins publish cleanupStagedRepository -S

- name: Release
uses: jreleaser/release-action@v2
Expand All @@ -79,6 +76,9 @@ jobs:
JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
JRELEASER_MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

- name: JReleaser output
if: always()
Expand Down
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,14 @@ subprojects {
resolutionStrategy.force "org.apache.commons:commons-lang3:$commonsLang3Version"
}
}

// Delete Gradle artifacts not suitable for publication to Maven Central
tasks.register('cleanupStagedRepository') {
doLast {
def repoDir = project.layout.buildDirectory.dir('repos/local/release/org/kordamp/gradle').get()
repoDir.dir('enforcer-gradle-plugin').asFile.deleteDir()
repoDir.dir('enforcer').asFile.deleteDir()
repoDir.dir('project-enforcer').asFile.deleteDir()
repoDir.dir('org.kordamp.gradle.enforcer.gradle.plugin').asFile.deleteDir()
}
}
25 changes: 21 additions & 4 deletions jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ project:
authors:
- Andres Almiray
license: Apache-2.0
extraProperties:
inceptionYear: 2020
inceptionYear: 2020
java:
groupId: org.kordamp.gradle
version: 1.8

release:
github:
Expand Down Expand Up @@ -62,11 +64,26 @@ release:
replacers:
- search: 'deps: '

signing:
active: ALWAYS
armored: true

deploy:
maven:
nexus2:
maven-central:
active: RELEASE
url: https://s01.oss.sonatype.org/service/local
closeRepository: true
releaseRepository: true
stagingRepositories:
- build/repos/local/release

announce:
twitter:
active: release
active: RELEASE
status: 🚀 {{projectName}} {{projectVersion}} has been released! {{releaseNotesUrl}}
mastodon:
active: release
active: RELEASE
host: https://mastodon.social
status: 🚀 {{projectName}} {{projectVersion}} has been released! {{releaseNotesUrl}}

0 comments on commit d5423d7

Please sign in to comment.