Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use goreleaser #72

Merged
merged 4 commits into from
Jan 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 10 additions & 45 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -8,7 +8,7 @@ import (
"github.com/simeji/jid"
)

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

func main() {
content := os.Stdin
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=