-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
38 lines (33 loc) · 1.27 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pipeline {
agent any
stages {
stage('Setup') {
steps {
// Fetch the gradle.properties file from Jenkins credentials
withCredentials([file(credentialsId: 'Gradle Properties', variable: 'GRADLE_PROPERTIES_PATH')]) {
sh 'cp $GRADLE_PROPERTIES_PATH gradle.properties'
}
}
}
stage('Build & Publish') {
steps {
script {
sh 'chmod +x gradlew'
if (env.BRANCH_NAME == 'master') {
echo "Building master branch"
sh './gradlew clean build publishMavenJavaPublicationToMystoriaProdRepository --stacktrace'
} else {
echo "Building feature or other branch: ${env.BRANCH_NAME}"
sh './gradlew clean build publishMavenJavaPublicationToMystoriaDevRepository --stacktrace'
}
}
archiveArtifacts artifacts: '**/framework-*.jar', fingerprint: true, followSymlinks: false, onlyIfSuccessful: true
}
}
stage('Cleanup') {
steps {
sh 'rm gradle.properties'
}
}
}
}