@@ -41,7 +41,8 @@ def TEST_NPM_REGISTRY = "https://eu.artifactory.swg-devops.com/artifactory/api/n
41
41
/**
42
42
* npm registry
43
43
*/
44
- def NPM_REGISTRY = " https://registry.npmjs.org/"
44
+ def NPM_REGISTRY = " registry.npmjs.org"
45
+ def NPM_FULL_REGISTRY = " https://registry.npmjs.org"
45
46
46
47
/**
47
48
* The root results folder for items configurable by environmental variables
@@ -144,6 +145,8 @@ pipeline {
144
145
PATH = " ${ NPM_CONFIG_PREFIX} /bin:${ PATH} "
145
146
146
147
// Credential to publish to npmjs.org
148
+ // NPM_CREDENTIALS_USR is email address
149
+ // NPM_REDENTIALS_PSW is the login token
147
150
NPM_CREDENTIALS = credentials(' ibmcics.npmjs.auth.token' )
148
151
}
149
152
@@ -516,7 +519,7 @@ pipeline {
516
519
echo " NEW_VERSION: ${ NEW_VERSION} "
517
520
// Retrieve released version from npmjs.org
518
521
def RELEASED_VERSION = sh (
519
- script : ' npm view "$(echo "console.log(require(\' ./package.json\' ).name);" | node)" version --registry ' + NPM_REGISTRY + ' || true' ,
522
+ script : ' npm view "$(echo "console.log(require(\' ./package.json\' ).name);" | node)" version --registry ' + NPM_FULL_REGISTRY + ' || true' ,
520
523
returnStdout : true
521
524
). trim()
522
525
echo " RELEASED_VERSION: ${ RELEASED_VERSION} "
@@ -580,12 +583,12 @@ pipeline {
580
583
sh " echo @brightside:registry=https://api.bintray.com/npm/ca/brightside/ >> .npmrc"
581
584
sh " echo @brightside:always-auth=false >> .npmrc"
582
585
if (BRANCH_NAME == MASTER_BRANCH ) {
583
- // Set credential
584
- sh " echo _auth=${ NPM_CREDENTIALS} >> .npmrc"
585
586
// Set registry
586
- sh " echo registry=$NPM_REGISTRY >> .npmrc"
587
+ sh " echo registry=$NPM_FULL_REGISTRY >> .npmrc"
588
+ // Set credential
589
+ sh " echo //$NPM_REGISTRY /:_authToken=${ NPM_CREDENTIALS_PSW} >> .npmrc"
587
590
// deploy
588
- echo " publishing to $N PM_REGISTRY "
591
+ echo " publishing to $N PM_FULL_REGISTRY "
589
592
sh " npm publish --tag latest"
590
593
} else if (BRANCH_NAME == DEV_BRANCH ) {
591
594
// Set version
0 commit comments