feat(releaser): add git only as releaser, will create a new tag with version only

This commit is contained in:
Nightapes
2020-01-05 18:41:44 +01:00
parent 6211095c38
commit 42fc522a43
19 changed files with 284 additions and 109 deletions

View File

@@ -39,13 +39,13 @@ func ReadAllEnvs() map[string]string {
}
//GetCIProvider get provider
func GetCIProvider(gitUtil *gitutil.GitUtil, envs map[string]string) (*ProviderConfig, error) {
func GetCIProvider(gitUtil *gitutil.GitUtil, configCheck bool, envs map[string]string) (*ProviderConfig, error) {
services := []Service{
Travis{},
GithubActions{},
GitlabCI{},
Git{gitUtil: gitUtil}, // GIt must be the last option to check
Git{gitUtil: gitUtil}, // Git must be the last option to check
}
for _, service := range services {
@@ -57,5 +57,9 @@ func GetCIProvider(gitUtil *gitutil.GitUtil, envs map[string]string) (*ProviderC
}
log.Debugf("%s", err.Error())
}
return nil, fmt.Errorf("could not find any CI, if running locally set env CI=true")
if configCheck {
return nil, fmt.Errorf("could not find any CI, if running locally set env CI=true")
}
return Git{gitUtil: gitUtil}.detect(map[string]string{"CI": "true"})
}

View File

@@ -127,7 +127,7 @@ func TestCi(t *testing.T) {
}
for _, config := range testConfigs {
provider, err := ci.GetCIProvider(gitUtilInMemory, config.envs)
provider, err := ci.GetCIProvider(gitUtilInMemory, true, config.envs)
assert.Equalf(t, config.hasError, err != nil, "Service %s should have error: %t -> %s", config.service, config.hasError, err)
assert.Equalf(t, config.result, provider, "Service %s should have provider", config.service)
}