Skip to content

Commit

Permalink
Add Github Action for release
Browse files Browse the repository at this point in the history
  • Loading branch information
orgads committed Sep 15, 2024
1 parent 30eca95 commit bf27b02
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN apk add --no-cache \
git \
gsl-dev \
gsl-static \
help2man \
libpcap-dev \
make \
ncurses-dev \
Expand All @@ -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"]
Expand Down

0 comments on commit bf27b02

Please sign in to comment.