This repository was archived by the owner on Apr 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
53 lines (51 loc) · 1.91 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
pipeline {
agent any
parameters {
booleanParam(name: 'SKIP_TESTS', defaultValue: false, description: 'Skip tests')
string(name: 'ALT_DEPLOYMENT_REPOSITORY', defaultValue: '', description: 'Alternative deployment repo')
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage ('Build') {
steps {
withMaven(maven: 'maven', mavenSettingsConfig: 'nexus-mvn-settings') {
sh "mvn -DskipTests=${params.SKIP_TESTS} clean compile install"
}
}
}
stage ('Publish') {
steps {
script {
env.MVN_ARGS=""
if (params.ALT_DEPLOYMENT_REPOSITORY != '') {
env.MVN_ARGS="-DaltDeploymentRepository=${params.ALT_DEPLOYMENT_REPOSITORY}"
}
if (env.BRANCH_NAME == 'master') {
env.MVN_ARGS="${env.MVN_ARGS} -Possrh-deploy"
env.NPM_DEPLOY="true"
}
}
withMaven(maven: 'maven', mavenSettingsConfig: 'nexus-mvn-settings',
mavenOpts: '-DskipTests=true') {
sh "mvn deploy $MVN_ARGS"
}
nodejs(nodeJSInstallationName: 'node 10', configId: 'npmrc-@charlyghislain') { catchError {
ansiColor('xterm') {
sh '''
[ "$NPM_DEPLOY" != "true" ] && exit 0
cd plancul-api/target/npm
npm publish --access public
cd ../../..
cd astronomy-api/target/npm
npm publish --access public
cd ../../..
'''
}
}}
}
}
}
}