fix: generate npm auth via PowerShell to bypass Jenkins Groovy sandbox

这个提交包含在:
XuqmGroup 2026-05-16 12:25:32 +08:00
父节点 4b1a85f04f
当前提交 e9b3a39ae0

9
Jenkinsfile vendored
查看文件

@ -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 {