MCPcopy
hub / github.com/sqlc-dev/sqlc / main

Function main

scripts/release.go:12–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func main() {
13 docker := flag.Bool("docker", false, "create a docker release")
14 flag.Parse()
15
16 version := os.Getenv("VERSION")
17 sha := os.Getenv("GITHUB_SHA")
18
19 if version == "" {
20 cmd := exec.Command("git", "show", "--no-patch", "--no-notes", "--pretty=%ci", sha)
21 out, err := cmd.CombinedOutput()
22 if err != nil {
23 log.Println(strings.TrimSpace(string(out)))
24 log.Fatal(err)
25 }
26
27 var date string
28 parts := strings.Split(string(out), " ")
29 date = strings.Replace(parts[0]+parts[1], "-", "", -1)
30 date = strings.Replace(date, ":", "", -1)
31 version = fmt.Sprintf("v0.0.0-%s-%s", date, sha[:12])
32 }
33
34 if *docker {
35 x := "-extldflags \"-static\" -X github.com/sqlc-dev/sqlc/internal/cmd.version=" + version
36 args := []string{
37 "build",
38 "-a",
39 "-ldflags", x,
40 "-o", "/workspace/sqlc",
41 "./cmd/sqlc",
42 }
43 cmd := exec.Command("go", args...)
44 cmd.Env = os.Environ()
45 out, err := cmd.CombinedOutput()
46 if err != nil {
47 log.Println(strings.TrimSpace(string(out)))
48 log.Fatal(err)
49 }
50 return
51 }
52
53 arch := flag.Arg(0)
54 if arch == "" {
55 log.Fatalf("missing platform_arch argument")
56 }
57
58 log.Fatal("publishing to Equinox has been disabled")
59}

Callers

nothing calls this directly

Calls 2

ParseMethod · 0.65
ReplaceMethod · 0.45

Tested by

no test coverage detected