2019-07-01 06:39:05 +02:00
|
|
|
STATICCHECK := $(GOPATH)/bin/staticcheck
|
2017-10-22 05:37:38 +02:00
|
|
|
RELEASE := $(GOPATH)/bin/github-release
|
|
|
|
|
|
|
|
UNAME := $(shell uname)
|
|
|
|
|
2019-07-01 06:39:05 +02:00
|
|
|
$(STATICCHECK):
|
|
|
|
go get honnef.co/go/tools/cmd/staticcheck
|
2017-10-22 05:37:38 +02:00
|
|
|
|
2019-07-01 06:39:05 +02:00
|
|
|
vet: $(STATICCHECK)
|
2017-10-22 05:37:38 +02:00
|
|
|
go list ./... | grep -v vendor | xargs go vet
|
2019-07-01 06:39:05 +02:00
|
|
|
go list ./... | grep -v vendor | xargs $(STATICCHECK)
|
2017-10-22 05:37:38 +02:00
|
|
|
|
|
|
|
test: vet
|
|
|
|
go list ./... | grep -v vendor | xargs go test
|
|
|
|
|
|
|
|
$(RELEASE): test
|
|
|
|
go get -u github.com/aktau/github-release
|
|
|
|
|
|
|
|
release: $(RELEASE)
|
|
|
|
ifndef version
|
|
|
|
@echo "Please provide a version"
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
ifndef GITHUB_TOKEN
|
|
|
|
@echo "Please set GITHUB_TOKEN in the environment"
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
git tag $(version)
|
|
|
|
git push origin --tags
|
|
|
|
mkdir -p releases/$(version)
|
|
|
|
GOOS=linux GOARCH=amd64 go build -o releases/$(version)/chroma-markdown-linux-amd64 .
|
|
|
|
GOOS=darwin GOARCH=amd64 go build -o releases/$(version)/chroma-markdown-darwin-amd64 .
|
|
|
|
GOOS=windows GOARCH=amd64 go build -o releases/$(version)/chroma-markdown-windows-amd64 .
|
|
|
|
# these commands are not idempotent so ignore failures if an upload repeats
|
|
|
|
$(RELEASE) release --user kevinburke --repo chroma-markdown --tag $(version) || true
|
|
|
|
$(RELEASE) upload --user kevinburke --repo chroma-markdown --tag $(version) --name chroma-markdown-linux-amd64 --file releases/$(version)/chroma-markdown-linux-amd64 || true
|
|
|
|
$(RELEASE) upload --user kevinburke --repo chroma-markdown --tag $(version) --name chroma-markdown-darwin-amd64 --file releases/$(version)/chroma-markdown-darwin-amd64 || true
|
|
|
|
$(RELEASE) upload --user kevinburke --repo chroma-markdown --tag $(version) --name chroma-markdown-windows-amd64 --file releases/$(version)/chroma-markdown-windows-amd64 || true
|