Commit 10bd948c authored by Christof Dorner's avatar Christof Dorner Committed by Nick Stenning

Publish to NPM on Jenkins when a new tag is created (#55)

parent b0952d5e
...@@ -15,4 +15,26 @@ node { ...@@ -15,4 +15,26 @@ node {
nodeEnv.inside("-e HOME=${workspace}") { nodeEnv.inside("-e HOME=${workspace}") {
sh 'make test' 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
}
} }
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
"test": "gulp test-app", "test": "gulp test-app",
"preversion": "npm run test", "preversion": "npm run test",
"version": "make clean all && ./scripts/update-changelog.js && git add CHANGELOG.md", "version": "make clean all && ./scripts/update-changelog.js && git add CHANGELOG.md",
"postversion": "git push && git push --tags && ./scripts/create-github-release.js" "postversion": "git push && git push --tags && ./scripts/create-github-release.js",
"prepublish": "npm run-script build"
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment