From 6338a3cf0effb639c7745c0373efa62e1e2b37a9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 29 Jan 2020 17:21:21 -0500 Subject: [PATCH] project: add goreleaser configuration. --- .gitignore | 3 +++ .goreleaser.yml | 30 ++++++++++++++++++++++++++++++ .travis.yml | 10 ++++++++++ cmd/zlint/main.go | 4 ++++ 4 files changed, 47 insertions(+) create mode 100644 .goreleaser.yml diff --git a/.gitignore b/.gitignore index ab5bea648..8d496e024 100644 --- a/.gitignore +++ b/.gitignore @@ -121,3 +121,6 @@ cmd/zlint-gtld-update/zlint-gtld-update ### Integration test data ### data + +### Goreleaser builds ### +dist diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..2b84be004 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,30 @@ +project_name: zlint +before: + hooks: + - go mod tidy +builds: + - + main: ./cmd/zlint/main.go + binary: zlint + env: + - CGO_ENABLED=0 + goos: + - linux + - freebsd + - windows + - darwin + goarch: + - amd64 +archives: + - + wrap_in_directory: true + replacements: + darwin: Darwin + linux: Linux + windows: Windows + amd64: x86_64 +snapshot: + name_template: "{{ .Tag }}-next" +release: + draft: true + prerelease: auto diff --git a/.travis.yml b/.travis.yml index a3190f36f..d1dc5d936 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,16 @@ script: # Run integration tests - make integration PARALLELISM=3 +deploy: + - provider: script + skip_cleanup: true + script: curl -sL https://git.io/goreleaser | bash + api_key: $GITHUB_AUTH_TOKEN + draft: true + on: + repo: zmap/zlint + tags: true + notifications: email: - dkumar11@illinois.edu diff --git a/cmd/zlint/main.go b/cmd/zlint/main.go index f779d889b..7551a907b 100644 --- a/cmd/zlint/main.go +++ b/cmd/zlint/main.go @@ -39,6 +39,9 @@ var ( // flags format string include string exclude string + + // version is replaced by GoReleaser using an LDFlags option at release time. + version = "dev" ) func init() { @@ -50,6 +53,7 @@ func init() { flag.BoolVar(&prettyprint, "pretty", false, "Pretty-print output") flag.Usage = func() { + fmt.Fprintf(os.Stderr, "ZLint version %s\n\n", version) fmt.Fprintf(os.Stderr, "Usage: %s [flags] file...\n", os.Args[0]) flag.PrintDefaults() }