Skip to content

Commit

Permalink
added debian build to release
Browse files Browse the repository at this point in the history
  • Loading branch information
mosajjal committed Aug 19, 2021
1 parent 70b4e8d commit 7457de0
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
42 changes: 41 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,45 @@ jobs:
docker cp $id:/tmp/dnsmonster-windows-amd64.exe /tmp/dnsmonster-windows-amd64.exe
strip --strip-all /tmp/dnsmonster-linux-amd64.bin
tar czf /tmp/dnsmonster-linux-amd64.bin.tar.gz -C /tmp/ dnsmonster-linux-amd64.bin
- name: build .deb file in /tmp/dnsmonster*.deb
run: |
# get version from latest git tag
export VER=$(git describe --tags --abbrev=0|sed -e 's/^v//')
# create a directory to build the debian package in
DIR="/tmp/dnsmonster_$VER-1_amd64"
# remove possible previous build temp files
rm -rf $DIR
mkdir -p $DIR/sbin $DIR/usr/share/man/man7 $DIR/DEBIAN $DIR/etc/bash_completion.d/ $DIR/usr/share/fish/vendor_completions.d
docker build -t dnsmonster-build:temp --no-cache --pull -f Dockerfile-release .
ID=$(docker create dnsmonster-build:temp)
docker cp $ID:/tmp/dnsmonster-linux-amd64.bin $DIR/sbin/dnsmonster
# remove temp container and image
docker rm -f $ID
docker rmi -f dnsmonster-build:temp
# generate manfile and completion files into appropiate locations
$DIR/sbin/dnsmonster --manPage > $DIR/usr/share/man/man7/dnsmonster.7
$DIR/sbin/dnsmonster --bashCompletion > $DIR/etc/bash_completion.d/dnsmonster.bash
$DIR/sbin/dnsmonster --fishCompletion > $DIR/usr/share/fish/vendor_completions.d/dnsmonster.fish
cat << EOF > $DIR/DEBIAN/control
Package: dnsmonster
Version: $VER
Architecture: amd64
Maintainer: Ali Mosajjal <hi@n0p.me>
Description: Passive DNS monitoring framework.
EOF
dpkg-deb --build --root-owner-group $DIR
- name: Upload Deb to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /tmp/dnsmonster-*.deb
asset_name: /tmp/dnsmonster_${{ github.ref }}-1_amd64.deb
tag: ${{ github.ref }}
overwrite: true
body: ""

- name: Upload Linux binary to release
uses: svenstaro/upload-release-action@v2
with:
Expand All @@ -30,6 +68,7 @@ jobs:
tag: ${{ github.ref }}
overwrite: true
body: ""

- name: Upload windows binary to release
uses: svenstaro/upload-release-action@v2
with:
Expand All @@ -39,3 +78,4 @@ jobs:
tag: ${{ github.ref }}
overwrite: true
body: ""

38 changes: 38 additions & 0 deletions build_deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

# get version from latest git tag
export VER=$(git describe --tags --abbrev=0|sed -e 's/^v//')

# create a directory to build the debian package in
DIR="/tmp/dnsmonster_$VER-1_amd64"

# remove possible previous build temp files
rm -rf $DIR

mkdir -p $DIR/sbin $DIR/usr/share/man/man7 $DIR/DEBIAN $DIR/etc/bash_completion.d/ $DIR/usr/share/fish/vendor_completions.d


docker build -t dnsmonster-build:temp --no-cache --pull -f Dockerfile-release .
ID=$(docker create dnsmonster-build:temp)

docker cp $ID:/tmp/dnsmonster-linux-amd64.bin $DIR/sbin/dnsmonster

# remove temp container and image
docker rm -f $ID
docker rmi -f dnsmonster-build:temp

# generate manfile and completion files into appropiate locations
$DIR/sbin/dnsmonster --manPage > $DIR/usr/share/man/man7/dnsmonster.7
$DIR/sbin/dnsmonster --bashCompletion > $DIR/etc/bash_completion.d/dnsmonster.bash
$DIR/sbin/dnsmonster --fishCompletion > $DIR/usr/share/fish/vendor_completions.d/dnsmonster.fish


cat << EOF > $DIR/DEBIAN/control
Package: dnsmonster
Version: $VER
Architecture: amd64
Maintainer: Ali Mosajjal <hi@n0p.me>
Description: Passive DNS monitoring framework.
EOF

dpkg-deb --build --root-owner-group $DIR

0 comments on commit 7457de0

Please sign in to comment.