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