|
1 | 1 | #!groovy |
2 | | -// Copyright © 2017 IBM Corp. All rights reserved. |
| 2 | +// Copyright © 2017, 2019 IBM Corp. All rights reserved. |
3 | 3 | // |
4 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | // you may not use this file except in compliance with the License. |
@@ -101,16 +101,14 @@ stage('Publish') { |
101 | 101 |
|
102 | 102 | // Upload using the NPM creds |
103 | 103 | withCredentials([string(credentialsId: 'npm-mail', variable: 'NPM_EMAIL'), |
104 | | - usernamePassword(credentialsId: 'npm-creds', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) { |
| 104 | + usernamePassword(credentialsId: 'npm-creds', passwordVariable: 'NPM_TOKEN', usernameVariable: 'NPM_USER')]) { |
105 | 105 | // Actions: |
106 | | - // 1. add the build ID to any snapshot version for uniqueness |
107 | | - // 2. install login helper |
108 | | - // 3. login to npm, using environment variables specified above |
109 | | - // 4. publish the build to NPM adding a snapshot tag if pre-release |
| 106 | + // 1. create .npmrc file for publishing |
| 107 | + // 2. add the build ID to any snapshot version for uniqueness |
| 108 | + // 3. publish the build to NPM adding a snapshot tag if pre-release |
110 | 109 | sh """ |
| 110 | + echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc |
111 | 111 | ${isReleaseVersion ? '' : ('npm version --no-git-tag-version ' + version + '.' + env.BUILD_ID)} |
112 | | - npm install --no-save npm-cli-login |
113 | | - ./node_modules/.bin/npm-cli-login |
114 | 112 | npm publish ${isReleaseVersion ? '' : '--tag snapshot'} |
115 | 113 | """ |
116 | 114 | } |
|
0 commit comments