diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 16fb093..35c46f2 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -28,6 +28,17 @@ builds: - arm64 ldflags: *build-ldflags + - id: windows-build + binary: mass + env: + - CGO_ENABLED=0 + goos: + - windows + goarch: + - amd64 + - arm64 + ldflags: *build-ldflags + archives: - id: linux-archives builds: @@ -39,6 +50,11 @@ archives: - darwin-build name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}" + - id: windows-archives + builds: + - windows-build + name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}" + checksum: name_template: 'checksums.txt' diff --git a/Makefile b/Makefile index 28b094f..918dabb 100644 --- a/Makefile +++ b/Makefile @@ -54,8 +54,10 @@ build: $(MAKE) build.macos; \ elif [ "$$(uname -s)" = "Linux" ]; then \ $(MAKE) build.linux; \ + elif echo "$$(uname -s)" | grep -q -E "^(MINGW|MSYS|Windows)"; then \ + $(MAKE) build.windows; \ else \ - echo "Error: Unsupported operating system. Please use 'make build.macos' or 'make build.linux' directly."; \ + echo "Error: Unsupported operating system. Please use 'make build.macos', 'make build.linux', or 'make build.windows' directly."; \ exit 1; \ fi @@ -67,6 +69,10 @@ build.macos: bin build.linux: bin GOOS=linux GOARCH=amd64 go build -o bin/mass-linux-amd64 -ldflags=${LD_FLAGS} +.PHONY: build.windows +build.windows: bin + GOOS=windows GOARCH=amd64 go build -o bin/mass-windows-amd64.exe -ldflags=${LD_FLAGS} + .PHONY: install.macos install.macos: build.macos rm -f ${INSTALL_PATH}/mass diff --git a/cmd/server.go b/cmd/server.go index 19cf93a..b516e5f 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -8,6 +8,7 @@ import ( "os" "os/signal" "path" + "runtime" "strings" "syscall" "time" @@ -127,7 +128,11 @@ func setupLogging(level string) { func handleSignals(ctx context.Context, s *server.BundleServer) { c := make(chan os.Signal, 2) - signal.Notify(c, os.Interrupt, syscall.SIGTERM) + signals := []os.Signal{os.Interrupt} + if runtime.GOOS != "windows" { + signals = append(signals, syscall.SIGTERM) + } + signal.Notify(c, signals...) go func(s *server.BundleServer) { for sig := range c { slog.Info("Shutting down", "signal", sig) diff --git a/pkg/bundle/publish.go b/pkg/bundle/publish.go index 31b44d3..565c2a0 100644 --- a/pkg/bundle/publish.go +++ b/pkg/bundle/publish.go @@ -44,6 +44,7 @@ func (p *Publisher) PackageBundle(ctx context.Context, bundleDir string, tag str if err != nil { return err } + bundleRelativePath = filepath.ToSlash(bundleRelativePath) if ignoreMatcher != nil && ignoreMatcher.MatchesPath(bundleRelativePath) { return nil