Skip to content

Commit

Permalink
prepare for a first release
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrobenolt committed Oct 19, 2023
1 parent 86dacc9 commit 1848375
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
@@ -1,6 +1,8 @@
.git
.gitignore
.dockerignore
.goreleaser.yaml
example
Dockerfile
Makefile
bin
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@
bin/
tmp-protoc/

dist/
46 changes: 46 additions & 0 deletions .goreleaser.yaml
@@ -0,0 +1,46 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines bellow are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- arm64
- amd64

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
12 changes: 9 additions & 3 deletions Makefile
Expand Up @@ -15,21 +15,24 @@ all: $(BIN)/$(app)
proto: \
$(PSDB_V1ALPHA1)/database.pb.go

clean: clean-proto clean-bin
clean: clean-bin clean-dist

clean-proto:
rm -rf $(PSDB_PROTO_OUT)

clean-bin:
rm -rf $(BIN)

clean-dist:
rm -rf dist

$(BIN):
mkdir -p $(BIN)

$(PSDB_PROTO_OUT):
mkdir -p $(PSDB_PROTO_OUT)

GO_INSTALL := env GOBIN=$(PWD)/$(BIN) go install
GO_INSTALL := env GOBIN=$(PWD)/$(BIN) go install -ldflags "-s -w" -trimpath

$(BIN)/buf: Makefile | $(BIN)
$(GO_INSTALL) github.com/bufbuild/buf/cmd/buf@v1.27.0
Expand All @@ -43,6 +46,9 @@ $(BIN)/protoc-gen-connect-go: Makefile | $(BIN)
$(BIN)/protoc-gen-go-vtproto: Makefile | $(BIN)
$(GO_INSTALL) github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@v0.5.0

$(BIN)/goreleaser: Makefile | $(BIN)
$(GO_INSTALL) github.com/goreleaser/goreleaser@v1.21.2

PROTO_TOOLS := $(BIN)/buf $(BIN)/protoc-gen-go $(BIN)/protoc-gen-connect-go $(BIN)/protoc-gen-go-vtproto
tools: $(PROTO_TOOLS)

Expand All @@ -69,4 +75,4 @@ docker:
run-mysql:
docker run -it --rm --name $(app)-mysqld -e MYSQL_ALLOW_EMPTY_PASSWORD="true" -e MYSQL_ROOT_PASSWORD="" -p 127.0.0.1:3306:3306 mysql:8.0.29

.PHONY: all proto clean clean-proto clean-bin tools run run-mysql
.PHONY: all proto clean clean-proto clean-bin clean-dist tools run run-mysql

0 comments on commit 1848375

Please sign in to comment.