github.com/giantswarm/apiextensions/v6@v6.6.0/hack/build-charts.go (about) 1 //go:generate go run . 2 3 package main 4 5 import ( 6 "context" 7 "log" 8 "net/http" 9 "os" 10 11 "github.com/giantswarm/microerror" 12 "github.com/google/go-github/v39/github" 13 "golang.org/x/oauth2" 14 15 "github.com/giantswarm/apiextensions/v6/pkg/crd" 16 ) 17 18 func main() { 19 ctx := context.Background() 20 httpClient := http.DefaultClient 21 if githubToken := os.Getenv("GITHUB_TOKEN"); githubToken != "" { 22 token := oauth2.Token{AccessToken: githubToken} 23 ts := oauth2.StaticTokenSource(&token) 24 httpClient = oauth2.NewClient(ctx, ts) 25 } 26 27 renderer := crd.Renderer{ 28 GithubClient: github.NewClient(httpClient), 29 LocalCRDDirectory: "../config/crd", 30 OutputDirectory: "../helm", 31 Patches: patches, 32 UpstreamAssets: upstreamReleaseAssets, 33 RemoteRepositories: remoteRepositories, 34 } 35 36 for _, provider := range []string{"common", "aws", "azure", "kvm"} { 37 err := renderer.Render(ctx, provider) 38 if err != nil { 39 log.Fatal(microerror.JSON(err)) 40 } 41 } 42 }