diff --git a/cmd/sql-migrate/.goreleaser.yaml b/cmd/sql-migrate/.goreleaser.yaml index 88ca0ce..1c76b93 100644 --- a/cmd/sql-migrate/.goreleaser.yaml +++ b/cmd/sql-migrate/.goreleaser.yaml @@ -29,7 +29,6 @@ builds: - netbsd - openbsd - wasip1 - - windows goarch: - amd64 - arm @@ -45,17 +44,35 @@ builds: goamd64: - v1 - v2 + - v3 + - v4 + - id: sql-migrate-windows + binary: sql-migrate + env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X main.version={{.Env.VERSION}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser + goos: + - windows + goarch: + - amd64 + - arm64 + goamd64: + - v1 + - v2 + - v3 + - v4 archives: - id: sql-migrate - ids: [sql-migrate] + ids: [sql-migrate, sql-migrate-windows] formats: [tar.gz, tar.zst] # this name template makes the OS and Arch compatible with the results of `uname`. # it uses the VERSION env var so the prefixed monorepo tag doesn't appear in archive filenames. name_template: >- sql-migrate_{{ .Env.VERSION }}_ {{- title .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 + {{- if eq .Arch "amd64" }}x86_64{{ if .Amd64 }}_{{ .Amd64 }}{{ end }} {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} diff --git a/tools/monorel/.goreleaser.yaml b/tools/monorel/.goreleaser.yaml index d5ad127..a2a2b98 100644 --- a/tools/monorel/.goreleaser.yaml +++ b/tools/monorel/.goreleaser.yaml @@ -34,34 +34,57 @@ builds: - plan9 - solaris - wasip1 + goarch: + - 386 + - amd64 + - arm + - arm64 + - loong64 + - mips + - mips64 + - mips64le + - mipsle + - ppc64 + - ppc64le + - riscv64 + - s390x + - wasm + goarm: + - 6 + - 7 + goamd64: + - v1 + - v2 + - v3 + - v4 + - id: monorel-windows + binary: monorel + env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X main.version={{.Env.VERSION}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser + goos: - windows - # iOS requires CGO_ENABLED=1 and the Xcode toolchain. - #- id: monorel-ios - # binary: monorel - # env: - # - CGO_ENABLED=1 - # goos: - # - ios - # Android CGO_ENABLED=0 builds arm64 only; CGO builds require the NDK. - #- id: monorel-android - # binary: monorel - # env: - # - CGO_ENABLED=0 - # goos: - # - android - # goarch: - # - arm64 + goarch: + - 386 + - amd64 + - arm64 + goamd64: + - v1 + - v2 + - v3 + - v4 archives: - id: monorel - ids: [monorel] + ids: [monorel, monorel-windows] formats: [tar.gz, tar.zst] # this name template makes the OS and Arch compatible with the results of `uname`. # it uses the VERSION env var so the prefixed monorepo tag doesn't appear in archive filenames. name_template: >- monorel_{{ .Env.VERSION }}_ {{- title .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 + {{- if eq .Arch "amd64" }}x86_64{{ if .Amd64 }}_{{ .Amd64 }}{{ end }} {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} diff --git a/tools/monorel/main.go b/tools/monorel/main.go index 3434cc4..a629b3f 100644 --- a/tools/monorel/main.go +++ b/tools/monorel/main.go @@ -63,14 +63,14 @@ var stopMarkers = []string{".git"} // separately via the --ios and --android-ndk flags. var defaultGoos = []string{ "darwin", "freebsd", "js", "linux", - "netbsd", "openbsd", "wasip1", "windows", + "netbsd", "openbsd", "wasip1", } // almostAllGoos extends defaultGoos with less-commonly-targeted CGO_ENABLED=0 platforms. var almostAllGoos = []string{ "aix", "darwin", "dragonfly", "freebsd", "illumos", "js", "linux", "netbsd", "openbsd", "plan9", - "solaris", "wasip1", "windows", + "solaris", "wasip1", } // defaultGoarch is the conservative architecture list for generated builds. @@ -90,12 +90,20 @@ var almostAllGoarch = []string{ // Included whenever "arm" appears in the goarch list. var defaultGoarm = []string{"6", "7"} -// defaultGoamd64 is the amd64 micro-architecture level list used with --almost-all. -var defaultGoamd64 = []string{"v1", "v2"} +// defaultGoamd64 is the amd64 micro-architecture level list. +var defaultGoamd64 = []string{"v1", "v2", "v3", "v4"} // almostAllGoamd64 is the amd64 micro-architecture level list used with --almost-all. var almostAllGoamd64 = []string{"v1", "v2", "v3", "v4"} +// defaultWindowsGoarch is the architecture list for Windows builds. +// Windows is kept in a separate build entry because it does not support +// ARM v6/v7, so it cannot share the same goarch matrix as non-Windows builds. +var defaultWindowsGoarch = []string{"amd64", "arm64"} + +// almostAllWindowsGoarch extends defaultWindowsGoarch with 32-bit x86. +var almostAllWindowsGoarch = []string{"386", "amd64", "arm64"} + // ── Types ────────────────────────────────────────────────────────────────── // binary describes one Go main package to build and release. @@ -1406,10 +1414,12 @@ func goreleaserYAML(projectName string, bins []binary, opts buildOptions) string goos := defaultGoos goarch := defaultGoarch goamd64 := defaultGoamd64 + windowsGoarch := defaultWindowsGoarch if opts.almostAll { goos = almostAllGoos goarch = almostAllGoarch goamd64 = almostAllGoamd64 + windowsGoarch = almostAllWindowsGoarch } // When multiple binaries share a module, define the common build options @@ -1496,17 +1506,42 @@ func goreleaserYAML(projectName string, bins []binary, opts buildOptions) string } } + // Windows-only builds: Windows does not support ARM v6/v7, so it cannot + // share the goarch matrix with the main non-Windows builds. + for _, bin := range bins { + wf(" - id: %s-windows\n", bin.name) + wf(" binary: %s\n", bin.name) + if bin.mainPath != "." { + wf(" main: %s\n", bin.mainPath) + } + wf(" env:\n - CGO_ENABLED=0\n") + wf(" ldflags:\n - -s -w"+ + " -X main.version={{.Env.VERSION}}"+ + " -X main.commit={{.Commit}}"+ + " -X main.date={{.Date}}"+ + " -X main.builtBy=goreleaser\n") + w(" goos:\n - windows\n") + w(" goarch:\n") + for _, a := range windowsGoarch { + wf(" - %s\n", a) + } + w(" goamd64:\n") + for _, v := range goamd64 { + wf(" - %s\n", v) + } + } + w("\narchives:\n") for _, bin := range bins { wf(" - id: %s\n", bin.name) - wf(" ids: [%s]\n", bin.name) + wf(" ids: [%s, %s-windows]\n", bin.name, bin.name) w(" formats: [tar.gz, tar.zst]\n") w(" # this name template makes the OS and Arch compatible with the results of `uname`.\n") w(" # it uses the VERSION env var so the prefixed monorepo tag doesn't appear in archive filenames.\n") w(" name_template: >-\n") wf(" %s_{{ .Env.VERSION }}_\n", bin.name) w(" {{- title .Os }}_\n") - w(" {{- if eq .Arch \"amd64\" }}x86_64\n") + w(" {{- if eq .Arch \"amd64\" }}x86_64{{ if .Amd64 }}_{{ .Amd64 }}{{ end }}\n") w(" {{- else if eq .Arch \"386\" }}i386\n") w(" {{- else }}{{ .Arch }}{{ end }}\n") w(" {{- if .Arm }}v{{ .Arm }}{{ end }}\n")