diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..33be49d --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,24 @@ +name: build + +on: + push: + tags: + - '*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: goreleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 95e51b3..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Go - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - - build: - name: Build - runs-on: ubuntu-latest - steps: - - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.15 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Get dependencies - run: go get -v -t -d ./... - - - name: Build - run: | - mkdir build - go build -v -o build/nftrace cmd/nftrace/main.go - - - uses: actions/upload-artifact@v2 - with: - name: nftrace - path: build/nftrace - -# - name: Test -# run: go test -v . diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..b9c8e9e --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,44 @@ +# This is an example .goreleaser.yml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +env: + - GO111MODULE=on +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy +builds: + - main: cmd/nftrace/main.go + binary: nftrace + env: + - CGO_ENABLED=0 + flags: + - -v + ldflags: + - -X github.com/eiginn/nftrace.BuildVersion={{.Version}} + goos: + - linux + goarch: + - amd64 + - arm64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +nfpms: + - formats: [deb] + package_name: "nftrace" + section: "net" + priority: "optional" + maintainer: "Ryan Carter " + description: Easier tracing of packets through iptables + homepage: "https://github.com/eiginn/nftrace" + license: "MIT" + dependencies: + - iptables + - libc6 (>= 2.26) diff --git a/Makefile b/Makefile index a8cdfcf..1064df2 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ VERSION := $(shell git describe --tags --always --dirty=-dev) +export VERSION .PHONY: all build clean test all: build build: - go build -mod vendor -v -o nftrace -ldflags="-X 'github.com/eiginn/nftrace.BuildVersion=$(VERSION)'" cmd/nftrace/main.go + mkdir -p dist + go build -mod vendor -v -o dist/nftrace -ldflags="-X 'github.com/eiginn/nftrace.BuildVersion=$(VERSION)'" cmd/nftrace/main.go clean: - rm -f nftrace + rm -rf dist diff --git a/go.mod b/go.mod index a077c15..4a26350 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/eiginn/nftrace -go 1.15 +go 1.16 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect