chore: update build system to publish signed github releases

We rely on the GitHub CLI tools to do this.
We publish the compressed source tarball and a detached PGP
signature for it.
We add the SHA256 checksum of the tarball as a note on the release.
Automatic links to the changes are also given.
This commit is contained in:
Roy Marples 2023-04-20 12:00:32 +01:00
parent 257259dd79
commit 0019d0b8c5
2 changed files with 27 additions and 14 deletions

View File

@ -9,10 +9,10 @@ GITREF?= HEAD
DISTSUFFIX=
DISTPREFIX?= dhcpcd-${VERSION}${DISTSUFFIX}
DISTFILEGZ?= ${DISTPREFIX}.tar.gz
DISTFILE?= ${DISTPREFIX}.tar.xz
DISTINFO= ${DISTFILE}.distinfo
DISTINFOSIGN= ${DISTINFO}.asc
DISTINFOMD= ${DISTINFO}.md
DISTSIGN= ${DISTFILE}.asc
CLEANFILES+= *.tar.xz
@ -49,29 +49,39 @@ clean:
distclean: clean
rm -f config.h config.mk config.log \
${DISTFILE} ${DISTFILEGZ} ${DISTINFO} ${DISTINFOSIGN}
${DISTFILE} ${DISTINFO} ${DISTINFOMD} ${DISTSIGN}
rm -f *.diff *.patch *.orig *.rej
for x in ${SUBDIRS} tests; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
dist-git:
git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE}
git archive --prefix=${DISTPREFIX}/ v${VERSION} | xz >${DISTFILE}
dist-inst:
mkdir /tmp/${DISTPREFIX}
cp -RPp * /tmp/${DISTPREFIX}
(cd /tmp/${DISTPREFIX}; make clean)
tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX}
tar -cvJpf ${DISTFILE} -C /tmp ${DISTPREFIX}
rm -rf /tmp/${DISTPREFIX}
dist: ${DIST}
distinfo: dist
rm -f ${DISTINFO} ${DISTINFOSIGN}
${CKSUM} ${DISTFILE} >${DISTINFO}
#printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO}
${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO}
chmod 644 ${DISTINFOSIGN}
ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
rm -f ${DISTINFO} ${DISTSIGN}
${SHA256} ${DISTFILE} >${DISTINFO}
${PGP} --armour --detach-sign ${DISTFILE}
chmod 644 ${DISTSIGN}
ls -l ${DISTFILE} ${DISTINFO} ${DISTSIGN}
{$DISTINFOMD}: ${DISTINFO}
echo '```' >${DISTINFOMD}
cat ${DISTINFO} >>${DISTINFOMD}
echo '```' >>${DISTINFOMD}
release: distinfo
gh release create v${VERSION} \
--title "dhcpcd ${VERSION}" --draft --generate-notes \
--notes-file ${DISTINFOMD} \
${DISTFILE} ${DISTSIGN}
snapshot:
rm -rf /tmp/${DISTPREFIX}

View File

@ -15,9 +15,12 @@ LINT?= lint
SED?= sed
HOST_SH?= /bin/sh
# This isn't very portable, but I generaly make releases from NetBSD
CKSUM?= cksum -a SHA256
PGP?= netpgp
# This isn't very portable, but I generaly make releases from DragonFlyBSD
SHA256?= sha256
PGP?= gpg
# old NetBSD defs
#SHA256?= cksum -a SHA256
#PGP?= netpgp
SCRIPT= ${LIBEXECDIR}/dhcpcd-run-hooks
HOOKDIR= ${LIBEXECDIR}/dhcpcd-hooks