debian: get latest release from github (#24)

* debian: get latest release from github

Use jq to parse result, barf with an error if something goes wrong.

* typo
This commit is contained in:
Miek Gieben 2017-11-13 14:50:01 +00:00 committed by GitHub
parent 6eb4d654b8
commit 7a53c3e6de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -3,7 +3,7 @@
# Build the debian packages
.PHONY: debian
debian:
dpkg-buildpackage -us -uc -b --target-arch amd64
dpkg-buildpackage -us -uc -b --target-arch amd64
dpkg-buildpackage -us -uc -b --target-arch armhf
dpkg-buildpackage -us -uc -b --target-arch arm64
# debs are one up

2
debian/control vendored
View file

@ -1,6 +1,6 @@
Source: coredns
Maintainer: Miek Gieben <miek@coredns.io>
Build-Depends: debhelper (>= 9), ca-certificates, wget, dh-systemd, lsb-release
Build-Depends: debhelper (>= 9), ca-certificates, curl, dh-systemd, lsb-release, jq
Package: coredns
Architecture: any

8
debian/rules vendored
View file

@ -1,6 +1,10 @@
#!/usr/bin/make -f
VERSION := 0.9.10
VERSION := $(shell curl -s https://api.github.com/repos/coredns/coredns/releases/latest | jq -r '.tag_name[1:length]')
# Github is ratelimiting this API pretty aggresively, error when not set.
ifeq ($(VERSION),null)
$(error No version found)
endif
DEB_HOST_ARCH := $(DEB_TARGET_ARCH)
DISTRIBUTION := $(shell lsb_release -sr)
@ -26,7 +30,7 @@ override_dh_auto_clean:
override_dh_auto_test:
override_dh_auto_build:
override_dh_auto_install:
wget -N --progress=dot:mega $(URL)
curl -L $(URL) -o $(TARBALL)
mkdir -p debian/coredns/usr/bin debian/coredns/etc/coredns
tar -xf $(TARBALL) -C debian/coredns/usr/bin
cp debian/Corefile debian/coredns/etc/coredns/Corefile