Set up a Jenkins pipeline with stages for building using Gradle, archiving artifacts, and sending notifications to Discord. This configuration ensures that builds are processed with Gradle and results are communicated effectively for branches 'main' and 'master'.
26 lines
715 B
Groovy
26 lines
715 B
Groovy
pipeline {
|
|
agent any
|
|
stages {
|
|
stage('Gradle') {
|
|
steps {
|
|
sh 'bash gradlew build'
|
|
}
|
|
}
|
|
stage('Archive') {
|
|
steps {
|
|
archiveArtifacts artifacts: 'build/libs/', followSymlinks: false
|
|
}
|
|
}
|
|
stage('discord') {
|
|
when {
|
|
anyOf {
|
|
branch 'main'
|
|
branch 'master'
|
|
}
|
|
}
|
|
steps {
|
|
discordSend description: "Build: ${BUILD_NUMBER}", showChangeset: true, result: currentBuild.currentResult, title: currentBuild.fullProjectName, webhookURL: env.discordwebhook
|
|
}
|
|
}
|
|
}
|
|
} |