mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-19 20:57:53 +02:00
<!-- Hi, thanks for contributing! Please make sure you read our CONTRIBUTING guide. Also, add tests and the respective documentation changes as well. --> <!-- If applied, this commit will... --> ... <!-- Why is this change being made? --> ... <!-- # Provide links to any relevant tickets, URLs or other resources --> ... --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
26 lines
604 B
Go
26 lines
604 B
Go
package partial
|
|
|
|
import (
|
|
"os"
|
|
"runtime"
|
|
|
|
"github.com/charmbracelet/x/exp/ordered"
|
|
"github.com/goreleaser/goreleaser/v2/pkg/context"
|
|
)
|
|
|
|
type Pipe struct{}
|
|
|
|
func (Pipe) String() string { return "partial" }
|
|
func (Pipe) Skip(ctx *context.Context) bool { return !ctx.Partial }
|
|
|
|
func (Pipe) Run(ctx *context.Context) error {
|
|
ctx.PartialTarget = getFilter()
|
|
return nil
|
|
}
|
|
|
|
func getFilter() string {
|
|
goos := ordered.First(os.Getenv("GGOOS"), os.Getenv("GOOS"), runtime.GOOS)
|
|
goarch := ordered.First(os.Getenv("GGOARCH"), os.Getenv("GOARCH"), runtime.GOARCH)
|
|
return goos + "_" + goarch
|
|
}
|