Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release MacOS with CGO enabled #523

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ endif
REPO=planetscale
NAME=pscale
BUILD_PKG=github.com/planetscale/cli/cmd/pscale
GORELEASE_CROSS_VERSION ?= v1.18.3

.PHONY: all
all: build test lint
Expand Down Expand Up @@ -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:${GORELEASE_CROSS_VERSION} \
release --rm-dist
10 changes: 1 addition & 9 deletions script/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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