fix(pkg/semanticrelease): remove check for branch prefix for releases

This commit is contained in:
Nightapes
2019-09-03 22:35:17 +02:00
parent e5ed8edb75
commit d03913e6d7

View File

@@ -2,7 +2,6 @@ package semanticrelease
import ( import (
"io/ioutil" "io/ioutil"
"strings"
"time" "time"
"github.com/Masterminds/semver" "github.com/Masterminds/semver"
@@ -98,14 +97,21 @@ func (s *SemanticRelease) GetNextVersion(provider *ci.ProviderConfig, force bool
analyzedCommits := s.analyzer.Analyze(commits) analyzedCommits := s.analyzer.Analyze(commits)
var newVersion semver.Version var newVersion semver.Version
foundBranchConfig := false
for branch, releaseType := range s.config.Branch { for branch, releaseType := range s.config.Branch {
if provider.Branch == branch || strings.HasPrefix(provider.Branch, branch) { if provider.Branch == branch {
log.Debugf("Found branch config for branch %s with release type %s", provider.Branch, releaseType) log.Debugf("Found branch config for branch %s with release type %s", provider.Branch, releaseType)
newVersion = s.calculator.CalculateNewVersion(analyzedCommits, lastVersion, releaseType, firstRelease) newVersion = s.calculator.CalculateNewVersion(analyzedCommits, lastVersion, releaseType, firstRelease)
foundBranchConfig = true
break break
} }
} }
if !foundBranchConfig {
log.Warnf("No branch config found for branch %s, will return last known version", provider.Branch)
newVersion = *lastVersion
}
releaseVersion := shared.ReleaseVersion{ releaseVersion := shared.ReleaseVersion{
Next: shared.ReleaseVersionEntry{ Next: shared.ReleaseVersionEntry{
Commit: provider.Commit, Commit: provider.Commit,