Skip to content

Commit

Permalink
build(release): rename Win32 and add macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
dbohdan committed Oct 26, 2024
1 parent 719ebf3 commit 55a30c5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions script/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type BuildTarget struct {
func main() {
version := os.Getenv("VERSION")
if version == "" {
fmt.Fprintln(os.Stderr, "VERSION environment variable must be set")
fmt.Fprintln(os.Stderr, "'VERSION' environment variable must be set")
os.Exit(1)
}

Expand All @@ -35,10 +35,12 @@ func main() {
}

targets := []BuildTarget{
{"darwin", "amd64"},
{"darwin", "arm64"},
{"freebsd", "amd64"},
{"linux", "amd64"},
{"linux", "arm64"},
{"linux", "riscv64"},
{"freebsd", "amd64"},
{"netbsd", "amd64"},
{"openbsd", "amd64"},
{"windows", "386"},
Expand All @@ -63,14 +65,22 @@ func build(dir string, target BuildTarget, version string) error {

// Map Go to user architecture names.
arch := target.arch
system := target.os

if arch == "386" {
arch = "i386"
arch = "x86"
}
if target.os == "linux" && arch == "amd64" {
if system == "darwin" {
system = "macos"
}
if (system == "linux" || system == "macos") && arch == "amd64" {
arch = "x86_64"
}
if system == "linux" && arch == "arm64" {
arch = "aarch64"
}

filename := fmt.Sprintf("%s-v%s-%s-%s%s", projectName, version, target.os, arch, ext)
filename := fmt.Sprintf("%s-v%s-%s-%s%s", projectName, version, system, arch, ext)
outputPath := filepath.Join(dir, filename)

cmd := exec.Command("go", "build", "-trimpath", "-o", outputPath, ".")
Expand Down

0 comments on commit 55a30c5

Please sign in to comment.