forked from nicoraynaud/angular-spring-batch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
71 lines (61 loc) · 2.04 KB
/
Copy pathJenkinsfile
File metadata and controls
71 lines (61 loc) · 2.04 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env groovy
node {
/**
* Setting global variable for this build
* branch = git compliant branch name
* artifactoryBaseUrl = Artifactory base URL
* towerTemplateUrl = Ansible Tower job template URL
* intEnv = Integration environment settings (for automatic deployment)
**/
def branch = env.BRANCH_NAME.replaceAll('/','-')
properties([parameters([booleanParam(defaultValue: false, description: 'Si activé, le build publiera la release sur Artifactory. (Attention, une release npm ne peut pas être modifée par la suite)', name: 'RELEASE')]),
disableConcurrentBuilds(), buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '15', numToKeepStr: '10'))])
/**
* Set configuration environment
**/
stage('config') {
// Set Java JDK in path
env.JAVA_HOME="${tool 'java-8'}"
env.PATH="${env.JAVA_HOME}/bin:${env.PATH}"
// Set Gradle tool and add it to the path
def gradleHome = tool 'gradle-4.10.2'
env.PATH = "${gradleHome}/bin:${env.PATH}"
}
/**
* Checkout latest branch code
**/
stage('checkout') {
checkout scm
}
/**
* Install tools & build
**/
stage('install tools') {
sh "gradle npm_install -PnodeInstall --no-daemon"
}
/**
* Install tools & build
**/
stage('build') {
sh "gradle npm_run_build -PnodeInstall --no-daemon"
}
/**
* Publish artifact
**/
stage('publish') {
/**
* Execute following steps
* only when on the (main) master branch
**/
if (branch.equals("master") && RELEASE == "true") {
configFileProvider([configFile(fileId: 'npmrc', targetLocation: '.npmrc')]) {
dir('dist/angular-spring-batch') {
sh "gradle -p ../.. npm_publish_dist/angular-spring-batch --no-daemon"
}
}
}
}
stage('delete workspace'){
deleteDir()
}
}