Uploading to Bintray as part of the release (#105)

CJ Hare 6 years ago committed by GitHub
parent ef50390398
commit 5a89e7dbd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      Jenkinsfile.release
  2. 22
      build.gradle

@ -0,0 +1,41 @@
void tryAddKnownHost(String hostUrl){
// ssh-keygen -F ${hostUrl} will fail (in bash that means status code != 0) if ${hostUrl} is not yet a known host
def statusCode = sh script:"ssh-keygen -F ${hostUrl}", returnStatus:true
if(statusCode != 0){
sh "mkdir -p ~/.ssh"
sh "ssh-keyscan ${hostUrl} >> ~/.ssh/known_hosts"
}
}
pipeline {
agent {
docker { image 'pegasyseng/pantheon-build:0.0.2' }
}
stages {
stage('Release') {
steps {
sshagent(
credentials: ['pegasys-admin-github-ssh-private-key']
) {
withCredentials([
usernamePassword(
credentialsId: 'pegasys-bintray',
usernameVariable: 'BINTRAY_USER',
passwordVariable: 'BINTRAY_KEY'
)
]) {
withEnv([
'GIT_COMMITTER_NAME="PegaSys Admin"',
'GIT_COMMITTER_EMAIL="pegasys.manager@gmail.com"',
'GIT_AUTHOR_NAME="PegaSys Admin"',
'GIT_AUTHOR_EMAIL="pegasys.manager@gmail.com"'
]) {
tryAddKnownHost('github.com')
sh './gradlew release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=0.8.0-RC2 -Prelease.newVersion=0.8.0-SNAPSHOT'
}
}
}
}
}
}
}

@ -409,8 +409,6 @@ release {
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: ' preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
tagCommitMessage = '[Gradle Release Plugin] - creating tag: ' tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: ' newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
tagTemplate = '${version}'
versionPropertyFile = 'gradle.properties'
buildTasks = [ buildTasks = [
'build', 'build',
'releaseIntegrationTest', 'releaseIntegrationTest',
@ -421,8 +419,9 @@ release {
] ]
git { git {
requireBranch = 'release-pipeline' requireBranch = 'master'
pushToRemote = 'origin' pushToRemote = 'origin'
pushToBranchPrefix = project.version.replace('SNAPSHOT','')
} }
} }
@ -431,17 +430,24 @@ apply plugin: 'com.jfrog.bintray'
bintray { bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY') key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
filesSpec { filesSpec {
from distTar.destinationDir.path from distTar.destinationDir.path
from distZip.destinationDir.path from distZip.destinationDir.path
into '.' into '.'
} }
publish = true
pkg { pkg {
repo = "pegasys-repo" repo = 'pegasys-repo'
name = "pantheon" name = 'pantheon'
userOrg = "consensys" userOrg = 'consensys'
licenses = ["Apache-2.0"] licenses = ['Apache-2.0']
vcsUrl = "https://github.com/PegaSysEng/pantheon" websiteUrl = 'https://github.com/PegaSysEng/pantheon'
issueTrackerUrl = 'https://github.com/PegaSysEng/pantheon/issues'
vcsUrl = 'https://github.com/PegaSysEng/pantheon.git'
version { version {
name = project.version name = project.version
released = new Date() released = new Date()

Loading…
Cancel
Save