1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

Update publish.go

This commit is contained in:
maxcask
2025-08-18 14:27:33 +03:00
committed by GitHub
parent 578fabe887
commit f330d36c76

View File

@@ -125,6 +125,7 @@ func (exec *Execute) publish(packageJSON, registry, username, password string, p
// set registry auth
if len(username) > 0 && len(password) > 0 {
log.Entry().Debug("adding registry credentials")
log.Entry().Debug("new line to check version")
// See https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/
// where it states: the presence of auth related settings that are not scoped to a specific registry found in a config file
// is no longer supported and will throw errors
@@ -132,6 +133,7 @@ func (exec *Execute) publish(packageJSON, registry, username, password string, p
log.Entry().Debugf("Added: registry %s, user %s", registry, username)
npmrc.Set(fmt.Sprintf("%s:%s", strings.TrimPrefix(registry, "https:"), "_auth"), CredentialUtils.EncodeUsernamePassword(username, password))
npmrc.Set("always-auth", "true")
log.Entry().Debugf(".npmrc file %s contents:\n%s", npmrc.filepath, npmrc.String())
}
// update .npmrc
if err := npmrc.Write(); err != nil {