Skip to content

Commit 6cf7838

Browse files
krombelGoliathLabs
andcommitted
add support for debian files
Co-authored-by: Felix <[email protected]>
1 parent 7da7968 commit 6cf7838

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@ jobs:
2929
name: linux-latest
3030
path: release
3131

32+
build-debian:
33+
name: Build Debian Packages
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: actions/setup-go@v5
39+
with:
40+
go-version-file: 'go.mod'
41+
check-latest: true
42+
43+
- name: Build
44+
run: |
45+
make BUILD_NUMBER="${GITHUB_REF#refs/tags/v}" release-deb
46+
mkdir release
47+
mv build/*.deb release
48+
- name: Upload artifacts
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: debian-latest
52+
path: release
53+
3254
build-windows:
3355
name: Build Windows
3456
runs-on: windows-latest
@@ -157,7 +179,7 @@ jobs:
157179
158180
release:
159181
name: Create and Upload Release
160-
needs: [build-linux, build-darwin, build-windows]
182+
needs: [build-debian, build-linux, build-darwin, build-windows]
161183
runs-on: ubuntu-latest
162184
steps:
163185
- uses: actions/checkout@v4
@@ -178,7 +200,7 @@ jobs:
178200
- name: Create sha256sum
179201
run: |
180202
cd artifacts
181-
for dir in linux-latest darwin-latest windows-latest
203+
for dir in debian-latest linux-latest darwin-latest windows-latest
182204
do
183205
(
184206
cd $dir
@@ -196,6 +218,10 @@ jobs:
196218
sha256sum <nebula | sed 's=-$=nebula-darwin.zip/nebula='
197219
sha256sum <nebula-cert | sed 's=-$=nebula-darwin.zip/nebula-cert='
198220
else
221+
for v in *.deb
222+
do
223+
sha256sum $v
224+
done
199225
for v in *.tar.gz
200226
do
201227
sha256sum $v
@@ -215,4 +241,4 @@ jobs:
215241
--verify-tag \
216242
--title "Release ${{ github.ref_name }}" \
217243
"${{ github.ref_name }}" \
218-
SHASUM256.txt *-latest/*.zip *-latest/*.tar.gz
244+
SHASUM256.txt *-latest/*.zip *-latest/*.tar.gz *-latest/*.deb

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ DOCKER_IMAGE_TAG ?= latest
2727

2828
LDFLAGS = -X main.Build=$(BUILD_NUMBER)
2929

30+
ALL_DEBIAN = linux-amd64 \
31+
linux-arm-7 \
32+
linux-arm64
33+
3034
ALL_LINUX = linux-amd64 \
3135
linux-386 \
3236
linux-ppc64le \
@@ -86,6 +90,9 @@ docker: docker/linux-$(shell go env GOARCH)
8690

8791
release: $(ALL:%=build/nebula-%.tar.gz)
8892

93+
94+
release-deb: $(ALL_DEBIAN:%=build/nebula-%.deb)
95+
8996
release-linux: $(ALL_LINUX:%=build/nebula-%.tar.gz)
9097

9198
release-freebsd: $(ALL_FREEBSD:%=build/nebula-%.tar.gz)
@@ -156,6 +163,22 @@ build/%/nebula.exe: build/%/nebula
156163
build/%/nebula-cert.exe: build/%/nebula-cert
157164
mv $< $@
158165

166+
build/nebula-%.deb: build/%/nebula build/%/nebula-cert
167+
cp -av dist/debian/ build/$*
168+
sed -i "s/ARCHITECTURE/$(word 2, $(subst -, ,$*))/" build/$*/debian/DEBIAN/control
169+
# fix package name
170+
if [ "$*" = "linux-arm-7" ]; then \
171+
sed -i "s/arm$$/armhf/" build/$*/debian/DEBIAN/control; \
172+
fi
173+
sed -i "s/VERSION/$(BUILD_NUMBER)/" build/$*/debian/DEBIAN/control
174+
mkdir -p build/$*/debian/usr/bin
175+
cp -av build/$*/nebula build/$*/nebula-cert build/$*/debian/usr/bin
176+
mkdir -p build/$*/debian/lib/systemd/system
177+
cp -v examples/service_scripts/nebula.service build/$*/debian/lib/systemd/system
178+
mkdir -p build/$*/debian/etc/nebula
179+
cp -v examples/config.yml build/$*/debian/etc/nebula
180+
dpkg-deb -Zxz --build --root-owner-group build/$*/debian build/nebula-$*.deb
181+
159182
build/nebula-%.tar.gz: build/%/nebula build/%/nebula-cert
160183
tar -zcv -C build/$* -f $@ nebula nebula-cert
161184

dist/debian/DEBIAN/conffiles

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/nebula/config.yml

dist/debian/DEBIAN/control

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Package: nebula
2+
Version: VERSION
3+
Architecture: ARCHITECTURE
4+
Maintainer: Freifunk München <[email protected]>
5+
Description: Nebula network connectivity daemon for encrypted communications
6+
More details in https://github.com/slackhq/nebula

0 commit comments

Comments
 (0)