forked from hypothesis/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
41 lines (34 loc) · 860 Bytes
/
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
#!groovy
node {
checkout scm
nodeEnv = docker.image("node:6.2")
workspace = pwd()
stage 'Build'
nodeEnv.inside("-e HOME=${workspace}") {
sh 'make clean'
sh 'make'
}
stage 'Test'
nodeEnv.inside("-e HOME=${workspace}") {
sh 'make test'
}
if (isTag()) {
stage 'Publish'
nodeEnv.inside("-e HOME=${workspace}") {
withCredentials([
[$class: 'StringBinding', credentialsId: 'npm-token', variable: 'NPM_TOKEN']]) {
sh "echo '//registry.npmjs.org/:_authToken=${env.NPM_TOKEN}' >> \$HOME/.npmrc"
sh "npm publish"
}
}
}
}
boolean isTag() {
try {
sh 'git describe --exact-match --tags'
return true
} catch (Exception e) {
echo e.toString()
return false
}
}