Skip to content

Commit

Permalink
Add goreleaser to perform release (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie authored Feb 21, 2019
1 parent 5aba8d5 commit 20017a7
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/kroki
/dist/
28 changes: 28 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project_name: kroki-cli

before:
hooks:
- go mod download

builds:
- env:
- CGO_ENABLED=0
- binary: kroki
goos:
- windows
- darwin
- linux
- openbsd
goarch:
- amd64

archive:
format_overrides:
- goos: windows
format: zip

release:
github:
owner: yuzutech
name: kroki-cli
draft: true
22 changes: 20 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,23 @@ install:
- go mod vendor

script:
- go test -race ./...
- golangci-lint run .
- make test
- make lint

jobs:
include:
- stage: goreleaser-snapshot
go: "1.11.x"
script:
- curl -sL https://git.io/goreleaser | head -n -2 | bash
- tar -xf /tmp/goreleaser.tar.gz -C $GOPATH/bin
- goreleaser --snapshot --skip-sign
- stage: goreleaser-release
go: "1.11.x"
if: |
repo = 'yuzutech/kroki-cli' AND \
tag IS present
script:
- curl -sL https://git.io/goreleaser | head -n -2 | bash
- tar -xf /tmp/goreleaser.tar.gz -C $GOPATH/bin
- goreleaser --skip-sign
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version := $(shell git describe --exact-match --tags $(git log -n1 --pretty='%h') 2> /dev/null || echo 'latest')
vcs_ref := $(shell git rev-parse HEAD)

GO_FILES = $(shell find . -type f -name '*.go')

.PHONY: all
all: clean kroki

kroki: $(GO_FILES)
go build -o $@ -ldflags "-s -w -X main.version=${version} -X main.commit=${vcs_ref}"

.PHONY: lint
lint: $(GO_FILES)
golangci-lint run ./...

.PHONY: test
test: $(GO_FILES)
go test -race ./...

.PHONY: clean
clean:
go clean
rm -rf kroki

0 comments on commit 20017a7

Please # to comment.