Skip to content

Commit

Permalink
project: add goreleaser configuration. (#374)
Browse files Browse the repository at this point in the history
Adds configuration for GoReleaser to the project/CI.

By default releases are added to the repository in draft status. This gives
maintainers a chance to write the release notes/changelog and verify the build
artifacts before publishing the release. Tags with "rc" in the name will be
marked as pre-release candidates automatically.

Updates #351
  • Loading branch information
Daniel McCarney authored Feb 3, 2020
1 parent 8a37cc7 commit 72fb7ad
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,6 @@ cmd/zlint-gtld-update/zlint-gtld-update

### Integration test data ###
data

### Goreleaser builds ###
dist
30 changes: 30 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions cmd/zlint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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()
}
Expand Down

0 comments on commit 72fb7ad

Please sign in to comment.