-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b322ac0
commit 767ebc8
Showing
3 changed files
with
111 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -e # exit with nonzero exit code if anything fails | ||
|
||
openssl aes-256-cbc -K $encrypted_330589789bd4_key -iv $encrypted_330589789bd4_iv -in deployment.key.enc -out deployment.key -d | ||
secreteFilePath=$(pwd)/deployment.key | ||
echo "Deployment key found" | ||
|
||
echo "Executing gradle deployToMavenCentral" | ||
./gradlew deployToMavenCentral -PdeploymentVersion=${TRAVIS_TAG} -Psigning.keyId=${signingKeyId} -Psigning.password=${signingPassword} -Psigning.secretKeyRingFile=$secreteFilePath -PossrhUsername=${ossrhUsername} -PossrhPassword=${ossrhPassword} --stacktrace --info | ||
|
||
rm $secreteFilePath |
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,99 @@ | ||
/* | ||
* Get the proper version for the project. This method will extract the version number from the project variable "deploymentVersion". | ||
*/ | ||
def getVersion = { | ||
if( ! project.hasProperty('deploymentVersion') ) { | ||
throw new RuntimeException("deploymentVersion not provided. You must specify a 'deploymentVersion' project variable (gradlew -PdeploymentVersion=..)") | ||
} | ||
|
||
String tmpDeploymentVersion = deploymentVersion.replaceFirst("v", ""); | ||
|
||
if( ! tmpDeploymentVersion.matches("\\d+\\.\\d+\\.\\d+")) { | ||
throw new RuntimeException("Version is not valid. Correct format is like 1.0.2 but was " + tmpDeploymentVersion) | ||
} | ||
|
||
return tmpDeploymentVersion; | ||
} | ||
|
||
/* | ||
* Assert that the project properties necessary for the deployment to sonatype are correctly set. | ||
*/ | ||
def assertDeploymentPropertiesAreSet = { | ||
boolean propertiesSet = project.getProperties().keySet().containsAll(Arrays.asList('ossrhUsername', 'ossrhPassword', 'signing.keyId', 'signing.password', 'signing.secretKeyRingFile')) | ||
if( ! propertiesSet ) { | ||
throw new RuntimeException("Deployment project properties are not correctly set: ossrhUsername, ossrhPassword, signing.keyId, signing.password, signing.secretKeyRingFile") | ||
} | ||
} | ||
|
||
signing { | ||
required { gradle.getTaskGraph().hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
task configureSonatypeDeployment(type: DefaultTask) << { | ||
|
||
assertDeploymentPropertiesAreSet() | ||
|
||
nexusStaging { | ||
packageGroup = "org.tensorics" | ||
username = ossrhUsername | ||
password = ossrhPassword | ||
// Sonatype Nexus may take some time to properly close the repo, it has to perform some checks | ||
delayBetweenRetriesInMillis = 10000 | ||
numberOfRetries = 10 | ||
} | ||
|
||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
|
||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
|
||
pom.project { | ||
name 'tensorics-expression' | ||
packaging 'jar' | ||
description '' | ||
url 'http://www.tensorics.org' | ||
|
||
groupId 'org.tensorics' | ||
artifactId 'tensorics-expression' | ||
version getVersion() | ||
|
||
scm { | ||
connection 'scm:git:https://github.com/tensorics/tensorics-expression.git' | ||
developerConnection 'scm:git:https://github.com/tensorics/tensorics-expression.git' | ||
url 'https://github.com/tensorics/tensorics-expression.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'andreacalia' | ||
name 'Andrea Calia' | ||
email '[email protected]' | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Define the deploying task and defining the order for the dependencies | ||
task deployToMavenCentral(dependsOn: ['configureSonatypeDeployment', 'uploadArchives', 'closeAndPromoteRepository'], type: DefaultTask) | ||
uploadArchives.mustRunAfter configureSonatypeDeployment | ||
closeAndPromoteRepository.mustRunAfter uploadArchives |