diff --git a/.goreleaser.yml b/.goreleaser.yml index ca2f84aa..9a2463ee 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -6,12 +6,37 @@ before: - go mod tidy - ./script/completions builds: + - id: darwin-amd64 + goos: + - darwin + goarch: + - amd64 + env: + - CC=o64-clang + - CXX=o64-clang++ + - CGO_ENABLED=1 + main: ./cmd/pscale/main.go + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} + binary: "pscale" + - id: darwin-arm64 + goos: + - darwin + goarch: + - arm64 + env: + - CC=oa64-clang + - CXX=oa64-clang++ + - CGO_ENABLED=1 + main: ./cmd/pscale/main.go + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} + binary: "pscale" - env: - CGO_ENABLED=0 goos: - linux - windows - - darwin goarch: - 386 - amd64 diff --git a/Makefile b/Makefile index e43e83f2..0969ed7c 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ endif REPO=planetscale NAME=pscale BUILD_PKG=github.com/planetscale/cli/cmd/pscale +GOLANG_CROSS_VERSION ?= v1.18.3 .PHONY: all all: build test lint @@ -54,3 +55,13 @@ push: clean: @echo "==> Cleaning artifacts" @rm ${NAME} + +.PHONY: release +release: + @docker run \ + --rm \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/go/src/${REPO}/${NAME} \ + -w /go/src/${REPO}/${NAME} \ + goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + release --rm-dist diff --git a/script/release.sh b/script/release.sh index 0e2fd61e..cf2ff34a 100755 --- a/script/release.sh +++ b/script/release.sh @@ -25,18 +25,10 @@ echo \ apt-get update apt-get install -y docker-ce-cli -echo "--- installing goreleaser" - -curl -L -o /tmp/goreleaser_Linux_x86_64.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.6.3/goreleaser_Linux_x86_64.tar.gz - -cd /tmp && tar -zxvf goreleaser_Linux_x86_64.tar.gz - -echo "--- running goreleaser" - echo "Login to the docker..." echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin export GORELEASER_CURRENT_TAG=$(buildkite-agent meta-data get "release-version") cd $WORKDIR -/tmp/goreleaser release --rm-dist +make release