forked from powmedia/pow-mongodb-fixtures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
49 lines (43 loc) · 1.25 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
def projectName = "pow-mongodb-fixtures"
pipeline {
agent {
node {
label "swarm2"
}
}
stages {
stage("Write npm config") {
steps {
ansiColor("xterm") {
writeNpmConfig()
}
}
}
stage("Build") {
steps {
ansiColor("xterm") {
sh "./scripts/build-in-docker.sh $projectName"
}
}
}
stage("Check if should publish") {
steps {
ansiColor("xterm") {
sh "docker run $projectName ./scripts/should-publish.sh && echo true > should-publish.txt || echo false > should-publish.txt"
}
}
}
stage("Publish") {
steps {
ansiColor("xterm") {
sh "[ \"true\" == \"\$(cat should-publish.txt)\" ] && docker run $projectName npm --verbose publish || echo Not publishing because should not publish"
}
}
}
}
}
def writeNpmConfig() {
withCredentials([string(credentialsId: "github-credentials-token", variable: "GITHUB_TOKEN")]) {
sh "./scripts/write-npm-config.sh"
}
}