From 21de2dc74cbae72b86f6d2137f4d509904b11699 Mon Sep 17 00:00:00 2001 From: mozillazg Date: Sat, 11 Jan 2025 11:24:15 +0000 Subject: [PATCH 1/2] use goreleaser --- .github/workflows/release-test.yml | 44 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 35 ++++++++++++++++++++++++ .goreleaser.yml | 25 +++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 .github/workflows/release-test.yml create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 0000000..cc2595e --- /dev/null +++ b/.github/workflows/release-test.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b2d504a --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..d531dda --- /dev/null +++ b/.goreleaser.yml @@ -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" From ef6fff19b3bfa2676758daffad28880775468379 Mon Sep 17 00:00:00 2001 From: mozillazg Date: Sat, 11 Jan 2025 11:35:04 +0000 Subject: [PATCH 2/2] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4343cca..cf713b1 100644 --- a/README.md +++ b/README.md @@ -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 ```