-
Notifications
You must be signed in to change notification settings - Fork 170
/
Jenkinsfile
50 lines (41 loc) · 1.46 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
node('master') {
stage('Checkout') {
if(env.GERRIT_REFSPEC && env.GERRIT_PATCHSET_REVISION) {
println "Building from Gerrit with Refspec: $GERRIT_REFSPEC and branch $GERRIT_PATCHSET_REVISION"
checkout([$class: 'GitSCM', branches: [[name: "$GERRIT_PATCHSET_REVISION"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'gerrit_id_rsa', name: "", refspec: "$GERRIT_REFSPEC", url: 'ssh://[email protected]:29418/tabris-js']]])
} else {
git url: '[email protected]:eclipsesource/tabris-js.git', credentialsId: 'tabris-js_id_rsa'
}
}
/* Requires the Docker Pipeline plugin to be installed */
docker.image('node:10-alpine').inside {
def scmInfo
stage('Checkout') {
scmInfo = checkout scm
}
stage('Build') {
ansiColor('xterm') {
sh 'npm i grunt-cli -g'
sh 'npm i'
if (env.TARGET == 'release') {
sh 'grunt -v --release'
} else {
sh 'grunt -v'
}
}
}
stage('Archive') {
archiveArtifacts 'build/**'
}
stage('Publish') {
if(env.TARGET == 'nightly') {
withCredentials([
string(credentialsId: 'TABRIS_NPM_REGISTRY_AUTH_TOKEN', variable: 'NPM_TOKEN'),
]) {
sh 'echo $NPM_TOKEN > $HOME/.npmrc'
sh 'cd build/tabris && npm publish --tag nightly'
}
}
}
}
}