Skip to content

Commit

Permalink
Merge pull request #4 from mozillazg/add-goreleaser
Browse files Browse the repository at this point in the history
use goreleaser
  • Loading branch information
jschwinger233 authored Jan 11, 2025
2 parents a1c87d6 + ef6fff1 commit 751cec0
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: release-test

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:

release-test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.2'

- name: Set up deps
run: |
sudo apt-get install -y gcc flex bison make autoconf libelf-dev
git submodule update --init --recursive
sudo make libpcap LIBPCAP_DIST_DIR=/usr/local CARCH=x86_64
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --snapshot --clean --skip=publish -p 1

- name: Store Releases
uses: actions/upload-artifact@v4
with:
name: ktcpdump_v0.0.0-next_linux_amd64.tar.gz
path: dist/ktcpdump_v0.0.0-next_linux_amd64.tar.gz
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release

on:
workflow_dispatch:
push:
tags:
- v*

jobs:
goreleaser:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.2'
env:
GOPATH: ${{ env.HOME }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean -p 1
env:
GOPATH: ${{ env.HOME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
builds:
- id: ktcpdump-amd64
binary: ktcpdump
env:
- CGO_ENABLED=1
- CC=gcc
flags:
- -tags=static
ldflags:
- -linkmode 'external'
- -extldflags "-static"
goos:
- linux
goarch:
- amd64

archives:
- builds:
- ktcpdump-amd64

release:
prerelease: auto

snapshot:
name_template: "{{ .Tag }}-next"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Please download the latest binary in the [releases](https://github.com/jschwinge

```
# follow https://documentation.ubuntu.com/server/reference/debugging/debug-symbol-packages/
sudo apt-get install linux-image-`uname -r`-dbgsym``
sudo apt-get install linux-image-`uname -r`-dbgsym
```
Expand Down

0 comments on commit 751cec0

Please sign in to comment.