Skip to content

Commit

Permalink
Try and add package building
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Carter committed Apr 21, 2021
1 parent 4b88a15 commit 10ef4a9
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 42 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
39 changes: 0 additions & 39 deletions .github/workflows/go.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
44 changes: 44 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
description: Easier tracing of packets through iptables
homepage: "https://github.com/eiginn/nftrace"
license: "MIT"
dependencies:
- iptables
- libc6 (>= 2.26)
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 10ef4a9

Please sign in to comment.