Skip to content

Commit

Permalink
Release MacOS with CGO enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dbussink committed Jun 29, 2022
1 parent 6feb519 commit e93695b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
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
GOLANG_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:${GOLANG_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

0 comments on commit e93695b

Please sign in to comment.