api-cli/Jenkinsfile

40 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-07-07 14:28:13 +02:00
pipeline {
agent any
environment {
2021-07-07 14:48:11 +02:00
NPM_REGISTRY = 'https://nexus.nclazz.de/repository/npm_releases'
2021-07-07 14:28:13 +02:00
NPM_CREDENTIALS = credentials('npm-publish')
NPM_MAIL = 'info@nclazz.de'
}
stages {
stage('Prepare') {
2021-07-07 14:51:31 +02:00
steps {
2021-07-07 15:55:07 +02:00
echo """
NPM_REGISTRY : $env.NPM_REGISTRY
NPM_MAIL : $env.NPM_MAIL
2021-07-07 14:51:31 +02:00
BRANCH : $BRANCH_NAME
2021-07-07 15:55:07 +02:00
"""
sh 'npm install'
2021-07-07 14:51:31 +02:00
}
2021-07-07 14:28:13 +02:00
}
stage('Set Version') {
steps {
when { branch 'master' }
sh 'npm version patch'
sh 'git push'
}
}
stage('Deploy') {
steps {
when { tag 'v*' }
2021-07-07 15:55:07 +02:00
sh 'npx npm-cli-login -u $NPM_CREDENTIALS_USR -p $NPM_CREDENTIALS_PSW -e $NPM_MAIL -r $NPM_REGISTRY'
2021-07-07 14:28:13 +02:00
sh 'npm publish'
sh 'npm logout --registry=$NPM_REGISTRY'
}
}
}
2021-07-07 15:55:07 +02:00
post {
always {
cleanWs()
}
}
2021-07-07 14:28:13 +02:00
}