MCPcopy Index your code
hub / github.com/coder/coder / main

Function main

scripts/release/main.go:33–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31)
32
33func main() {
34 // Pre-flight checks.
35 toplevel, err := run("git", "rev-parse", "--show-toplevel")
36 if err != nil {
37 _, _ = fmt.Fprintf(os.Stderr, "ERROR: %v\n", err)
38 _, _ = fmt.Fprintf(os.Stderr, "NOTE: This command must be run in the coder/coder repository.\n")
39 os.Exit(1)
40 }
41
42 if err = checkCoderRepo(toplevel); err != nil {
43 _, _ = fmt.Fprintf(os.Stderr, "ERROR: %v\n", err)
44 _, _ = fmt.Fprintf(os.Stderr, "NOTE: This command must be run in the coder/coder repository.\n")
45 os.Exit(1)
46 }
47
48 r := &releaseCommand{
49 fs: afero.NewBasePathFs(afero.NewOsFs(), toplevel),
50 logger: slog.Make(sloghuman.Sink(os.Stderr)).Leveled(slog.LevelInfo),
51 }
52
53 var channel string
54
55 cmd := serpent.Command{
56 Use: "release <subcommand>",
57 Short: "Prepare, create and publish releases.",
58 Options: serpent.OptionSet{
59 {
60 Flag: "debug",
61 Description: "Enable debug logging.",
62 Value: serpent.BoolOf(&r.debug),
63 },
64 {
65 Flag: "github-token",
66 Description: "GitHub personal access token.",
67 Env: "GITHUB_TOKEN",
68 Value: serpent.StringOf(&r.ghToken),
69 },
70 {
71 Flag: "dry-run",
72 FlagShorthand: "n",
73 Description: "Do not make any changes, only print what would be done.",
74 Value: serpent.BoolOf(&r.dryRun),
75 },
76 },
77 Children: []*serpent.Command{
78 {
79 Use: "promote <version>",
80 Short: "Promote version to stable.",
81 Middleware: r.debugMiddleware, // Serpent doesn't support this on parent.
82 Handler: func(inv *serpent.Invocation) error {
83 ctx := inv.Context()
84 if len(inv.Args) == 0 {
85 return xerrors.New("version argument missing")
86 }
87 if !r.dryRun && r.ghToken == "" {
88 return xerrors.New("GitHub personal access token is required, use --gh-token or GH_TOKEN")
89 }
90

Callers

nothing calls this directly

Calls 11

autoversionMethod · 0.95
checkCoderRepoFunction · 0.85
ExitMethod · 0.80
runFunction · 0.70
ContextMethod · 0.65
NewMethod · 0.65
RunMethod · 0.65
InvokeMethod · 0.45
IsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected