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 10, 2024
1 parent fcd8f34 commit 5e1ba11
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 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-latest
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 @@ -85,15 +85,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 @@ -12,6 +12,7 @@ RUN apk add --no-cache \
git \
gsl-dev \
gsl-static \
help2man \
libpcap-dev \
make \
ncurses-dev \
Expand All @@ -31,9 +32,11 @@ RUN --mount=type=bind,target=.git,source=.git \
-DUSE_PCAP=1 \
-DUSE_GSL=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
5 changes: 4 additions & 1 deletion docker/Dockerfile.full
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN apk add --no-cache \
git \
gsl-dev \
gsl-static \
help2man \
libpcap-dev \
linux-headers \
lksctp-tools-dev \
Expand All @@ -38,9 +39,11 @@ RUN --mount=type=bind,target=.git,source=.git \
-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 5e1ba11

Please sign in to comment.