40 lines
1.1 KiB
Groovy
40 lines
1.1 KiB
Groovy
pipeline {
|
|
agent any
|
|
environment {
|
|
NPM_REGISTRY = 'https://nexus.nclazz.de/repository/npm_releases'
|
|
NPM_CREDENTIALS = credentials('npm-publish')
|
|
NPM_MAIL = 'info@nclazz.de'
|
|
}
|
|
stages {
|
|
stage('Prepare') {
|
|
steps {
|
|
echo """
|
|
NPM_REGISTRY : $env.NPM_REGISTRY
|
|
NPM_MAIL : $env.NPM_MAIL
|
|
BRANCH : $BRANCH_NAME
|
|
"""
|
|
sh 'npm install'
|
|
}
|
|
}
|
|
stage('Set Version') {
|
|
steps {
|
|
when { branch 'master' }
|
|
sh 'npm version patch'
|
|
sh 'git push'
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
steps {
|
|
when { tag 'v*' }
|
|
sh 'npx npm-cli-login -u $NPM_CREDENTIALS_USR -p $NPM_CREDENTIALS_PSW -e $NPM_MAIL -r $NPM_REGISTRY'
|
|
sh 'npm publish'
|
|
sh 'npm logout --registry=$NPM_REGISTRY'
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
cleanWs()
|
|
}
|
|
}
|
|
} |