2018-11-13 03:54:39 +00:00
|
|
|
@Library('forge-shared-library')_
|
|
|
|
|
|
|
|
pipeline {
|
2018-11-15 20:40:30 +00:00
|
|
|
options {
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
}
|
2018-11-13 03:54:39 +00:00
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'gradlewrapper:latest'
|
|
|
|
args '-v gradlecache:/gradlecache'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
environment {
|
2018-11-13 06:29:46 +00:00
|
|
|
GRADLE_ARGS = '--no-daemon --console=plain' // No daemon for now as FG3 kinda derps. //'-Dorg.gradle.daemon.idletimeout=5000'
|
2019-02-22 09:01:09 +00:00
|
|
|
DISCORD_WEBHOOK = credentials('forge-discord-jenkins-webhook')
|
2019-02-22 05:26:45 +00:00
|
|
|
DISCORD_PREFIX = "Job: Forge Branch: ${BRANCH_NAME} Build: #${BUILD_NUMBER}"
|
|
|
|
JENKINS_HEAD = 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png'
|
2018-11-13 03:54:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('fetch') {
|
|
|
|
steps {
|
2018-11-13 04:24:14 +00:00
|
|
|
checkout scm
|
2019-03-14 23:33:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('notify_start') {
|
|
|
|
when {
|
|
|
|
not {
|
|
|
|
changeRequest()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
2019-02-22 05:26:45 +00:00
|
|
|
discordSend(
|
|
|
|
title: "${DISCORD_PREFIX} Started",
|
|
|
|
successful: true,
|
|
|
|
result: 'ABORTED', //White border
|
|
|
|
thumbnail: JENKINS_HEAD,
|
|
|
|
webhookURL: DISCORD_WEBHOOK
|
|
|
|
)
|
2018-11-13 03:54:39 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-13 06:29:46 +00:00
|
|
|
stage('setup') {
|
2018-11-13 04:18:43 +00:00
|
|
|
steps {
|
2018-11-15 20:40:30 +00:00
|
|
|
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue setup'
|
2018-11-13 04:18:43 +00:00
|
|
|
script {
|
2018-11-14 04:29:42 +00:00
|
|
|
env.MYVERSION = sh(returnStdout: true, script: './gradlew :forge:properties -q | grep "version:" | awk \'{print $2}\'').trim()
|
2018-11-13 04:18:43 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-14 23:33:50 +00:00
|
|
|
}
|
|
|
|
stage('changelog') {
|
|
|
|
when {
|
|
|
|
not {
|
|
|
|
changeRequest()
|
2018-11-13 03:54:39 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-14 23:33:50 +00:00
|
|
|
steps {
|
|
|
|
writeChangelog(currentBuild, 'build/changelog.txt')
|
|
|
|
}
|
2018-11-13 04:13:59 +00:00
|
|
|
}
|
|
|
|
stage('publish') {
|
2018-11-13 04:18:43 +00:00
|
|
|
when {
|
|
|
|
not {
|
|
|
|
changeRequest()
|
2018-11-13 03:54:39 +00:00
|
|
|
}
|
2018-11-13 04:18:43 +00:00
|
|
|
}
|
|
|
|
environment {
|
|
|
|
FORGE_MAVEN = credentials('forge-maven-forge-user')
|
|
|
|
CROWDIN = credentials('forge-crowdin')
|
|
|
|
KEYSTORE = credentials('forge-jenkins-keystore-old')
|
|
|
|
KEYSTORE_KEYPASS = credentials('forge-jenkins-keystore-old-keypass')
|
|
|
|
KEYSTORE_STOREPASS = credentials('forge-jenkins-keystore-old-keypass')
|
|
|
|
}
|
|
|
|
steps {
|
2019-05-23 23:02:15 +00:00
|
|
|
sh './gradlew ${GRADLE_ARGS} :forge:publish -PforgeMavenUser=${FORGE_MAVEN_USR} -PforgeMavenPassword=${FORGE_MAVEN_PSW} -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}'
|
2019-02-22 05:30:01 +00:00
|
|
|
sh 'curl --user ${FORGE_MAVEN} http://files.minecraftforge.net/maven/manage/promote/latest/net.minecraftforge.forge/${MYVERSION}'
|
2018-11-13 03:54:39 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-15 22:00:18 +00:00
|
|
|
stage('test_publish_pr') { //Publish to local repo to test full process, but don't include credentials so it can't sign/publish to maven
|
|
|
|
when {
|
|
|
|
changeRequest()
|
|
|
|
}
|
|
|
|
environment {
|
|
|
|
CROWDIN = credentials('forge-crowdin')
|
|
|
|
}
|
|
|
|
steps {
|
2019-05-23 23:02:15 +00:00
|
|
|
sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}'
|
2018-11-15 22:00:18 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-13 03:54:39 +00:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
2019-02-22 05:26:45 +00:00
|
|
|
script {
|
|
|
|
archiveArtifacts artifacts: 'projects/forge/build/libs/**/*.*', fingerprint: true, onlyIfSuccessful: true, allowEmptyArchive: true
|
|
|
|
//junit 'build/test-results/*/*.xml'
|
|
|
|
//jacoco sourcePattern: '**/src/*/java'
|
|
|
|
|
2019-03-14 23:33:50 +00:00
|
|
|
if (env.CHANGE_ID == null) { // This is unset for non-PRs
|
|
|
|
discordSend(
|
|
|
|
title: "${DISCORD_PREFIX} Finished ${currentBuild.currentResult}",
|
|
|
|
description: '```\n' + getChanges(currentBuild) + '\n```',
|
|
|
|
successful: currentBuild.resultIsBetterOrEqualTo("SUCCESS"),
|
|
|
|
result: currentBuild.currentResult,
|
|
|
|
thumbnail: JENKINS_HEAD,
|
|
|
|
webhookURL: DISCORD_WEBHOOK
|
|
|
|
)
|
|
|
|
}
|
2019-02-22 05:26:45 +00:00
|
|
|
}
|
2018-11-13 03:54:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|