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

View File

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