66 "errors"
77 "flag"
88 "fmt"
9- "github.com/go-semantic-release/semantic-release/pkg/semrel"
109 "github.com/go-semantic-release/semantic-release/pkg/condition"
10+ "github.com/go-semantic-release/semantic-release/pkg/semrel"
1111 "github.com/go-semantic-release/semantic-release/pkg/update"
1212 "io/ioutil"
1313 "log"
@@ -43,7 +43,7 @@ func loadConfig() *SemRelConfig {
4343
4444func main () {
4545 token := flag .String ("token" , os .Getenv ("GITHUB_TOKEN" ), "github token" )
46- slug := flag .String ("slug" , os . Getenv ( "TRAVIS_REPO_SLUG" ), "slug of the repository" )
46+ slug := flag .String ("slug" , condition . GetDefaultRepoSlug ( ), "slug of the repository" )
4747 changelogFile := flag .String ("changelog" , "" , "creates a changelog file" )
4848 ghr := flag .Bool ("ghr" , false , "create a .ghr file with the parameters for ghr" )
4949 noci := flag .Bool ("noci" , false , "run semantic-release locally" )
@@ -71,6 +71,10 @@ func main() {
7171 if * token == "" {
7272 exitIfError (errors .New ("github token missing" ))
7373 }
74+
75+ ci := condition .NewCI ()
76+ logger .Printf ("detected CI: %s\n " , ci .Name ())
77+
7478 if * slug == "" {
7579 exitIfError (errors .New ("slug missing" ))
7680 }
@@ -86,7 +90,7 @@ func main() {
8690 logger .Println ("repo is private" )
8791 }
8892
89- currentBranch := condition .GetCurrentBranch ()
93+ currentBranch := ci .GetCurrentBranch ()
9094 if currentBranch == "" {
9195 exitIfError (fmt .Errorf ("current branch not found" ))
9296 }
@@ -102,12 +106,17 @@ func main() {
102106 defaultBranch = "*"
103107 }
104108
105- currentSha := condition .GetCurrentSHA ()
109+ currentSha := ci .GetCurrentSHA ()
106110 logger .Println ("found current sha: " + currentSha )
107111
108112 if ! * noci {
109113 logger .Println ("running CI condition..." )
110- exitIfError (condition .Travis (* token , defaultBranch , isPrivate || * isTravisCom ))
114+ config := condition.CIConfig {
115+ "token" : * token ,
116+ "defaultBranch" : defaultBranch ,
117+ "private" : isPrivate || * isTravisCom ,
118+ }
119+ exitIfError (ci .RunCondition (config ))
111120 }
112121
113122 logger .Println ("getting latest release..." )
0 commit comments