-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
25 lines (25 loc) · 1002 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
pipeline {
agent { label "node12" }
options { disableConcurrentBuilds() }
stages {
stage("Checkout") {
steps {
cleanWs()
checkout([$class: 'GitSCM', branches: [[name: '$BRANCH_NAME']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '83ff6dc5-45b4-4996-b383-e1f225203f3c', url: 'git@github.com:amilabs/node-metrics.git']]])
}
}
stage("Publish") {
when { tag 'v*' }
steps {
script{
withCredentials([string(credentialsId: 'amilabs-npm-token', variable: 'NPM_TOKEN')]) {
sh "echo //registry.npmjs.org/:_authToken=${env.NPM_TOKEN} > .npmrc"
sh "echo email=jenkins@amilabs.pro >> .npmrc"
sh "echo always-auth=true >> .npmrc"
sh "npm publish"
}
}
}
}
}
}