This repository has been archived by the owner on Jun 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use goreleaser * Fix version embedding for Go modules. Signed-off-by: Ben Kochie <[email protected]>
- Loading branch information
1 parent
e16881b
commit 7573cb1
Showing
4 changed files
with
45 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ pubsubbeat.test | |
build/ | ||
data/ | ||
logs/ | ||
dist/ | ||
dashboards/ | ||
|
||
# IntelliJ IDEA | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This is an example goreleaser.yaml file with some sane defaults. | ||
# Make sure to check the documentation at http://goreleaser.com | ||
before: | ||
hooks: | ||
- make clean | ||
- go mod tidy | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
hooks: | ||
post: make dashboards | ||
checksum: | ||
name_template: 'checksums.txt' | ||
project_name: pubsubbeat | ||
snapshot: | ||
name_template: "{{ .Tag }}" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
archives: | ||
- wrap_in_directory: true | ||
files: | ||
- README.md | ||
- NOTICE | ||
- LICENSE | ||
- fields.yml | ||
- pubsubbeat.yml | ||
- pubsubbeat.reference.yml | ||
- dashboards/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
BEAT_NAME=pubsubbeat | ||
BUILD_DIR=bin | ||
BEAT_PATH=github.com/GoogleCloudPlatform/pubsubbeat | ||
GOBUILD_FLAGS=-ldflags "-X $(BEAT_PATH)/vendor/github.com/elastic/beats/libbeat/version.buildTime=$(NOW) -X $(BEAT_PATH)/vendor/github.com/elastic/beats/libbeat/version.commit=$(COMMIT_ID)" | ||
EXES=linux windows darwin | ||
RELEASE_TEMPLATE_DIR=${BUILD_DIR}/releases/template | ||
|
||
NOW ?= $(shell date --iso-8601=seconds) | ||
COMMIT_ID ?= $(shell git rev-parse HEAD) | ||
VERSION_LDFLAGS := \ | ||
-X github.com/elastic/beats/libbeat/version.buildTime=$(NOW) \ | ||
-X github.com/elastic/beats/libbeat/version.commit=$(COMMIT_ID) | ||
GOBUILD_FLAGS=-ldflags "$(VERSION_LDFLAGS)" | ||
|
||
.PHONY: build | ||
build: | ||
|
@@ -34,23 +38,8 @@ update: | |
@echo "TODO: update deps" | ||
|
||
.PHONY: release | ||
release: $(EXES) | ||
|
||
$(EXES): release-template | ||
@echo "Generating release: " $@ | ||
|
||
mkdir -p ${BUILD_DIR}/releases/$@ | ||
cp -r ${RELEASE_TEMPLATE_DIR}/. ${BUILD_DIR}/releases/$@ | ||
|
||
GOOS=$@ GOARCH=amd64 go build -o ${BUILD_DIR}/releases/$@/${BEAT_NAME} ${GOBUILD_FLAGS} | ||
|
||
tar -zcvf ${BUILD_DIR}/releases/[email protected] -C ${BUILD_DIR}/releases $@ | ||
|
||
.PHONY: release-template | ||
release-template: | ||
mkdir -p ${RELEASE_TEMPLATE_DIR} | ||
|
||
cp {${BEAT_NAME}.yml,${BEAT_NAME}.reference.yml} ${RELEASE_TEMPLATE_DIR} | ||
cp {README.md,NOTICE,LICENSE,fields.yml} ${RELEASE_TEMPLATE_DIR} | ||
release: dashboards | ||
goreleaser --snapshot --skip-publish --rm-dist | ||
|
||
cp -r _meta/kibana ${RELEASE_TEMPLATE_DIR}/dashboards | ||
dashboards: | ||
cp -r _meta/kibana dashboards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters