Skip to content

Commit

Permalink
add goreleaser and github action
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwinger233 committed Mar 11, 2023
1 parent 5739e7d commit 9228063
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: goreleaser

on:
push:
tags:
- v*

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up environment variables
run: |
echo "VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

35 changes: 35 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
before:
hooks:
- go mod download

builds:
- id: skbdump
binary: skbdump
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64

archives:
- replacements:
linux: Linux
amd64: x86_64

checksum:
name_template: 'checksums.txt'

release:
prerelease: auto

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

26 changes: 26 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"strings"

flag "github.com/spf13/pflag"
)

type Config struct {
Iface string
Priority uint32
SkbFilename string
PcapFilename string
PcapFilterExp string
}

var config Config

func initConfig() {
flag.StringVarP(&config.Iface, "interface", "i", "lo", "interface to capture")
flag.Uint32VarP(&config.Priority, "priority", "p", 1, "filter priority")
flag.StringVarP(&config.SkbFilename, "skb-filename", "s", "skbdump.skb", "output skb filename")
flag.StringVarP(&config.PcapFilename, "pcap-filename", "w", "skbdump.pcap", "output pcap filename")
flag.Parse()
config.PcapFilterExp = strings.Join(flag.Args(), " ")
}

0 comments on commit 9228063

Please sign in to comment.