From bf27b023bccd863af3a5089df94e6f9590314704 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 10 Sep 2024 10:12:20 +0300 Subject: [PATCH] Add Github Action for release --- .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++++ README.md | 16 +++++++--------- docker/Dockerfile | 5 ++++- 3 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f6a32e62 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: build-static + run: docker build -f docker/Dockerfile --output=. --target=bin . + - name: Set version + run: | + TAG=${{ github.ref_name }} + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + - name: pack + run: | + git ls-files -z | grep -zv '^\.\|gtest\|gmock\|version.h' | \ + tar --transform "s:^version.h:include/version.h:" \ + --transform "s:^:sipp-$VERSION/:" \ + --sort=name --mtime="@$(git log -1 --format=%ct)" \ + --owner=0 --group=0 --null --files-from=- \ + --numeric-owner -zcf sipp-$VERSION.tar.gz \ + sipp.1 version.h + - uses: ncipollo/release-action@v1 + with: + generateReleaseNotes: true + artifacts: "sipp-*.tar.gz,sipp" diff --git a/README.md b/README.md index dd115724..b1b7bc93 100644 --- a/README.md +++ b/README.md @@ -88,15 +88,13 @@ list](https://lists.sourceforge.net/lists/listinfo/sipp-users). ``` * Then: ``` - mkdir sipp-$VERSION - git ls-files -z | tar -c --null \ - --exclude=gmock --exclude=gtest --files-from=- | tar -xC sipp-$VERSION - cp sipp.1 sipp-$VERSION/ - # check version, and do - cp ${PROJECT_BINARY_DIR:-.}/version.h sipp-$VERSION/include/ - tar --sort=name --mtime="@$(git log -1 --format=%ct)" \ - --owner=0 --group=0 --numeric-owner \ - -czf sipp-$VERSION.tar.gz sipp-$VERSION + git ls-files -z | grep -zv '^\.\|gtest\|gmock\|version.h' | \ + tar --transform "s:^version.h:include/version.h:" \ + --transform "s:^:sipp-$VERSION/:" \ + --sort=name --mtime="@$(git log -1 --format=%ct)" \ + --owner=0 --group=0 --null --files-from=- \ + --numeric-owner -zcf sipp-$VERSION.tar.gz \ + sipp.1 version.h ``` * Upload to github as "binary". Note that github replaces tilde sign (for ~rcX) with a period. diff --git a/docker/Dockerfile b/docker/Dockerfile index cf32e902..2a9a25d0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,6 +14,7 @@ RUN apk add --no-cache \ git \ gsl-dev \ gsl-static \ + help2man \ libpcap-dev \ make \ ncurses-dev \ @@ -38,9 +39,11 @@ RUN --mount=type=bind,target=.git,source=.git \ ${DEBUG:+-DDEBUG=1} \ ${FULL:+-DUSE_SSL=1 -DUSE_SCTP=1} \ && ninja +RUN help2man --output=sipp.1 -v -v --no-info \ + --name='SIP testing tool and traffic generator' ./sipp FROM scratch AS bin -COPY --from=build /sipp/sipp /sipp +COPY --from=build /sipp/sipp /sipp/sipp.1 /sipp/version.h / FROM alpine:3.20 CMD ["sipp"]