Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: "📤 Publish Snapshot version to Artifactory (repo.grails.org)"
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }}
MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }}
MAVEN_PUBLISH_SNAPSHOT_URL: ${{ secrets.MAVEN_PUBLISH_SNAPSHOT_URL }}
run: ./gradlew publish
32 changes: 23 additions & 9 deletions gradle/publish-config.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository

ext.set('signing.keyId', findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY'))
ext.set('signing.password', findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE'))
ext.set('signing.secretKeyRingFile', findProperty('signing.secretKeyRingFile'))
Expand Down Expand Up @@ -89,6 +91,17 @@ publishing {
}
}
}
if (!isReleaseVersion) {
repositories {
maven {
credentials {
username = System.getenv('MAVEN_PUBLISH_USERNAME')
password = System.getenv('MAVEN_PUBLISH_PASSWORD')
}
url = uri(System.getenv('MAVEN_PUBLISH_SNAPSHOT_URL') ?: 'https://repo.grails.org/artifactory/plugins3-snapshots-local')
}
}
}
}

def mavenPublication = publishing.publications.named('maven')
Expand All @@ -103,19 +116,20 @@ tasks.withType(Sign).configureEach {
onlyIf { isReleaseVersion }
}

nexusPublishing {
repositories {
sonatype {
nexusUrl = uri('https://ossrh-staging-api.central.sonatype.com/service/local/')
snapshotRepositoryUrl = uri('https://central.sonatype.com/repository/maven-snapshots/')
username = System.getenv('SONATYPE_USERNAME')
password = System.getenv('SONATYPE_PASSWORD')
stagingProfileId = System.getenv('SONATYPE_STAGING_PROFILE_ID')
if (isReleaseVersion) {
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri('https://ossrh-staging-api.central.sonatype.com/service/local/')
snapshotRepositoryUrl = uri('https://central.sonatype.com/repository/maven-snapshots/')
username = System.getenv('SONATYPE_USERNAME')
password = System.getenv('SONATYPE_PASSWORD')
}
}
}
}

//do not generate extra load on Nexus with new staging repository if signing fails
tasks.named('initializeSonatypeStagingRepository') {
tasks.withType(InitializeNexusStagingRepository).configureEach {
shouldRunAfter = tasks.withType(Sign)
}