mirror of
https://github.com/drone-plugins/drone-npm.git
synced 2026-06-14 05:12:29 +08:00
Add flag to fail publishing if version conflict in NPM
This commit is contained in:
@@ -19,15 +19,16 @@ import (
|
||||
type (
|
||||
// Config for the plugin.
|
||||
Config struct {
|
||||
Username string
|
||||
Password string
|
||||
Token string
|
||||
Email string
|
||||
Registry string
|
||||
Folder string
|
||||
SkipVerify bool
|
||||
Tag string
|
||||
Access string
|
||||
Username string
|
||||
Password string
|
||||
Token string
|
||||
Email string
|
||||
Registry string
|
||||
Folder string
|
||||
SkipVerify bool
|
||||
FailIfConflict bool
|
||||
Tag string
|
||||
Access string
|
||||
}
|
||||
|
||||
npmPackage struct {
|
||||
@@ -252,6 +253,9 @@ func shouldPublishPackage(config Config, npm *npmPackage) (bool, error) {
|
||||
|
||||
if strings.Compare(npm.Version, value) == 0 {
|
||||
log.Info("Version found in the registry")
|
||||
if config.FailIfConflict {
|
||||
return false, errors.New("Cannot publish package due to version conflict")
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user