Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#24: Add OSS sonatype publishing script for publishing test snapshots.
- Loading branch information
1 parent
4def38f
commit cf454e3
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// OSS SONATYPE SNAPSHOTS upload configuration | ||
final snapshotsRepository = 'https://oss.sonatype.org/content/repositories/snapshots/' | ||
|
||
uploadArchives { | ||
doFirst { | ||
logger.info("Verifying OSS SONATYPE credentials:") | ||
def authentication = repositories.mavenDeployer.snapshotRepository.authentication | ||
if (!(authentication.userName?.trim() && authentication.password?.trim())) { | ||
throw new InvalidUserDataException('OSS SONATYPE User or API Key is not set. Please ensure one of the ' + | ||
"following is set:" + | ||
"1. OSS_USER and OSS_KEY environment variables.\n" + | ||
"2. -DossUser and -DossKey java runtime properties.\n" + | ||
"3. ossUser and ossKey properties in gradle.properties file.") | ||
} | ||
|
||
validateSnapshotVersion("Publishing to OSS SONATYPE can only be performed for $SNAPSHOT versions") | ||
} | ||
|
||
repositories { | ||
mavenDeployer { | ||
snapshotRepository(url: snapshotsRepository) { | ||
authentication( | ||
userName: rootProject.hasProperty('ossUser') ? rootProject.property('ossUser') : System.getenv('OSS_USER'), | ||
password: rootProject.hasProperty('ossKey') ? rootProject.property('ossKey') : System.getenv('OSS_KEY') | ||
) | ||
} | ||
|
||
pom.project { | ||
name rootProject.name | ||
|
||
url scmProjectUrl | ||
licenses { | ||
license { | ||
name "The Apache Software License, Version 2.0" | ||
url "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
distribution "repo" | ||
} | ||
} | ||
scm { | ||
connection "scm:git:$scmHttpsUrl" | ||
developerConnection "scm:git:$scmSshUrl" | ||
url "$scmProjectUrl" | ||
} | ||
developers { | ||
developer { | ||
id 'heshamMassoud' | ||
name 'Hesham Massoud' | ||
url 'https://github.com/heshamMassoud' | ||
email 'hesham.massoud@commercetools.com' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
void validateSnapshotVersion(String prefix) throws InvalidUserDataException { | ||
// validate version has snapshot suffix to publish it to oss sonatype | ||
if (!(rootProject.version?.trim() && rootProject.version.endsWith(SNAPSHOT_SUFFIX))) { | ||
throw new InvalidUserDataException( | ||
"$prefix.\nPlease, specify -Dbuild.version=<version-name>$SNAPSHOT_SUFFIX as the build argument.\n" + | ||
"Current version is \"$rootProject.version\"") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
ossUser=<<please ask support for OSS credentials>> | ||
ossKey=<<please ask support for OSS credentials>> | ||
bintrayUser=<<please ask support for bintray credentials>> | ||
bintrayKey=<<please ask support for bintray credentials>> | ||
org.ajoberstar.grgit.auth.username=<<github token to publish javadoc>> |