From d4350aa569af688ce7c0cb7d28f9b51ca9909cdc Mon Sep 17 00:00:00 2001 From: Masahiro Nagano Date: Fri, 27 Nov 2020 16:24:11 +0900 Subject: [PATCH 1/3] goreleaser by github actions --- .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ .goreleaser.yml | 12 +++++++----- Makefile | 3 +-- README.md | 12 ++++++------ chocon.go | 6 +++--- 5 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..76ef607 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: release +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 8b0cabd..a3b2703 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -5,11 +5,13 @@ builds: - linux goarch: - amd64 - ldflags: - - -X main.Version={{.Version}} -archive: - format: zip - name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" + - arm64 + ignore: + - goos: darwin + goarch: arm64 +archives: + - format: zip + name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" release: github: owner: kazeburo diff --git a/Makefile b/Makefile index 6ecd1f0..4203b07 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ VERSION=0.12.1 -LDFLAGS=-ldflags "-X main.Version=${VERSION}" +LDFLAGS=-ldflags "-w -s -X main.version=${VERSION}" all: chocon @@ -22,4 +22,3 @@ tag: git tag v${VERSION} git push origin v${VERSION} git push origin master - goreleaser --rm-dist diff --git a/README.md b/README.md index 3bb4a97..3cf55f3 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,15 @@ # Installation -``` -go get -u github.com/kazeburo/chocon -``` +download from release page or build from source + +## build from source -# Build +git clone this repository and ``` -make bundle -make +$ make +$ cp chocon /path/to/bin ``` # Run diff --git a/chocon.go b/chocon.go index 4d30397..58b4889 100644 --- a/chocon.go +++ b/chocon.go @@ -26,8 +26,8 @@ import ( ) var ( - // Version chocon version - Version string + // version chocon version + version string ) type cmdOpts struct { @@ -101,7 +101,7 @@ func printVersion() { fmt.Printf(`chocon %s Compiler: %s %s `, - Version, + version, runtime.Compiler, runtime.Version()) } From 5fee73f56c41f593c7430d85733975bd73fa0844 Mon Sep 17 00:00:00 2001 From: Masahiro Nagano Date: Fri, 27 Nov 2020 16:27:42 +0900 Subject: [PATCH 2/3] update go --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 78b04f2..3ecf22d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: [ '1.14.x' ] + go: [ '1.15.x'] steps: - name: Set up Go From de1fbfb8be4466f106a5436a8efb9d3b2238a96d Mon Sep 17 00:00:00 2001 From: Masahiro Nagano Date: Fri, 27 Nov 2020 16:29:12 +0900 Subject: [PATCH 3/3] fix version --- chocon.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chocon.go b/chocon.go index 58b4889..661fc05 100644 --- a/chocon.go +++ b/chocon.go @@ -137,7 +137,7 @@ func _main() int { } transport := makeTransport(opts.KeepaliveConns, opts.MaxConnsPerHost, opts.ProxyReadTimeout) - var handler http.Handler = proxy.New(&transport, Version, upstream, logger) + var handler http.Handler = proxy.New(&transport, version, upstream, logger) statsChocon, err := statsHTTP.NewCapa(opts.StatsBufsize, opts.StatsSpfactor) if err != nil {