diff --git a/Jenkinsfile b/Jenkinsfile index 1b71bf3..3c49042 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,11 +67,10 @@ pipeline { stage('Publish to Nexus') { steps { withCredentials([usernamePassword(credentialsId: 'NEXUS_CREDS', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) { - script { - def auth = (NPM_USER + ':' + NPM_PASS).bytes.encodeBase64().toString() - writeFile file: '.npmrc', text: "//nexus.xuqinmin.com/repository/npm-hosted/:_auth=${auth}\n" - bat "npm publish --registry %NEXUS_REGISTRY%" - } + bat """ + powershell -NonInteractive -Command "Set-Content .npmrc ('//nexus.xuqinmin.com/repository/npm-hosted/:_auth=' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(\$env:NPM_USER + ':' + \$env:NPM_PASS)))" + npm publish --registry %NEXUS_REGISTRY% + """ } } post {