Skip to content

Commit

Permalink
Merge pull request #72 from simeji/use_goreleaser
Browse files Browse the repository at this point in the history
Use goreleaser
  • Loading branch information
simeji authored Jan 4, 2019
2 parents b5d8918 + e35ecb5 commit d613a0d
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 46 deletions.
55 changes: 10 additions & 45 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,26 @@ jobs:
- image: circleci/golang:latest
steps:
- checkout
- run: go get -v -t -d ./...
- run: go test -v ./
- run: go test -v ./cmd/jid
build:
release:
docker:
- image: circleci/golang:latest
steps:
- checkout
- run:
name: update packages
command: go get -v -t -d ./...
- run:
name: install gox
command: go get github.com/mitchellh/gox
- run:
name: build jid
command: cd cmd/jid && gox -ldflags '-w -s'
- persist_to_workspace:
root: .
paths:
- cmd/jid/*
deploy:
docker:
- image: circleci/golang:latest
steps:
- attach_workspace:
at: .
- run:
name: make a zip dir
command: mkdir builds
- run:
name: create zip files
command: |
for name in `cd cmd/jid && find jid_* | grep -v .go`; do
zip builds/${name}.zip cmd/jid/$name
done
- run:
name: list binary
command: ls builds
name: build jid using goreleaser
command: curl -sL https://git.io/goreleaser | bash
workflows:
version: 2
build_and_deploy:
test_and_release:
jobs:
- test
- build:
- release:
requires:
- test
# filters:
# tags:
# only: /.*/
- deploy:
requires:
- build
# filters:
# tags:
# only: /.*/
# branches:
# only: master
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ test.*
# jid package
jid
*.out
*.log
dist
43 changes: 43 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# you may remove this if you don't use vgo
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
main: ./cmd/jid/jid.go
ldflags:
- -s -w
goos:
- windows
- openbsd
- netbsd
- linux
- freebsd
- darwin
goarch:
- arm64
- amd64
- 386
archive:
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format: zip
files:
- none*
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
# for Validation
#release:
# disable: true
2 changes: 1 addition & 1 deletion cmd/jid/jid.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/simeji/jid"
)

const VERSION = "0.7.2"
const VERSION = "0.7.3"

func main() {
content := os.Stdin
Expand Down
12 changes: 12 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module github.com/simeji/jid

require (
github.com/bitly/go-simplejson v0.5.0
github.com/fatih/color v1.7.0 // indirect
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/mattn/go-runewidth v0.0.4
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed
github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5
github.com/pkg/errors v0.8.0
)
16 changes: 16 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed h1:bAVGG6B+R5qpSylrrA+BAMrzYkdAoiTaKPVxRB+4cyM=
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5 h1:d+C3xJdxZT7wNlxqEwbXn3R355CwAhYBL9raVNfSnK0=
github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5/go.mod h1:GYFm0zZgTNeoK1QxuIofRDasy2ibmaJZhZLzwsMXUF4=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

0 comments on commit d613a0d

Please sign in to comment.