From 9e0057a86442a0dfa6e68b67d62a76067574c5ff Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 20 Feb 2026 14:53:30 +0000 Subject: [PATCH] [build] Allow for generation of all release information Allow for automatic generation of the release name, release title, and release notes (derived from the relevant section of the changelog). Signed-off-by: Michael Brown --- .github/workflows/build.yml | 32 +++++++++++++++++ RELNOTES.tmpl.md | 23 +++++++++++++ src/Makefile | 2 ++ src/Makefile.housekeeping | 68 ++++++++++++++++++++++++++++++++++--- 4 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 RELNOTES.tmpl.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c6b36031..caafe47f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -509,6 +509,37 @@ jobs: path: | ipxeboot.tar.gz + version: + name: Version + runs-on: ubuntu-latest + container: + image: ghcr.io/ipxe/ipxe-builder-utils + env: + bindir: bin + steps: + + - name: Check out code + uses: actions/checkout@v6 + + - name: Build + working-directory: src + run: | + make ${{ env.bindir }}/version.txt \ + ${{ env.bindir }}/relname.txt \ + ${{ env.bindir }}/reltitle.txt \ + ${{ env.bindir }}/relnotes.md + + - name: Upload + uses: actions/upload-artifact@v6 + with: + name: version + if-no-files-found: error + path: | + src/${{ env.bindir }}/version.txt + src/${{ env.bindir }}/relname.txt + src/${{ env.bindir }}/reltitle.txt + src/${{ env.bindir }}/relnotes.md + publish: name: Publish runs-on: ubuntu-latest @@ -521,6 +552,7 @@ jobs: - shim - combine - netboot + - version if: >- github.ref == 'refs/heads/master' && vars.PAGES_REPO_NAME diff --git a/RELNOTES.tmpl.md b/RELNOTES.tmpl.md new file mode 100644 index 000000000..bf1a6c653 --- /dev/null +++ b/RELNOTES.tmpl.md @@ -0,0 +1,23 @@ +Downloads +========= + +Binaries +-------- + + - [ipxe.iso][iso] (Bootable ISO image) + - [ipxe.usb][usb] (Bootable USB or SD card image) + - [ipxeboot.tar.gz][netboot] (Network boot server files) + +[iso]: ${BINURL}/ipxe.iso +[usb]: ${BINURL}/ipxe.usb +[netboot]: ${BINURL}/ipxeboot.tar.gz + +Source code +----------- + + - [${SRCNAME}.tar.gz][tarball] + +[tarball]: ${SRCURL}.tar.gz + +Changes +------- diff --git a/src/Makefile b/src/Makefile index 8513b2106..36684fd98 100644 --- a/src/Makefile +++ b/src/Makefile @@ -57,6 +57,8 @@ GENKEYMAP := ./util/genkeymap.py DOXYGEN := doxygen LCAB := lcab QEMUIMG := qemu-img +PANDOC := pandoc +ENVSUBST := envsubst ############################################################################### # diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index 78fbe8a71..50a78c8d8 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -1094,11 +1094,6 @@ $(BIN)/NIC : $(AUTO_DEPS) @perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@ CLEANUP += $(BIN)/NIC # Doesn't match the $(BIN)/*.* pattern -# Generate version number record -# -$(BIN)/version.txt : $(MAKEDEPS) - @$(ECHO) "$(VERSION)" > $@ - # Analyse a target name (e.g. "bin/dfe538--prism2_pci.rom.tmp") and # derive the variables: # @@ -1616,6 +1611,69 @@ $(BIN)/%.bxs : $(BIN)/%.tmp endif # defined(BIN) +############################################################################### +# +# Versioning +# + +ifdef BIN + +REPOURL := https://github.com/ipxe/ipxe +ifeq ($(EXTRAVERSION),) +RELNAME := v$(firstword $(VERSION)) +CLMARKER := [$(RELNAME)] +SRCNAME := ipxe-$(firstword $(VERSION)) +SRCURL := $(REPOURL)/archive/$(RELNAME) +BINURL := $(REPOURL)/releases/download/$(RELNAME) +else +RELNAME := +CLMARKER := [Unreleased] +SRCNAME := ipxe +SRCURL := $(REPOURL)/archive/$(GITVERSION) +BINURL := https://boot.ipxe.org +endif + +# Generate version number record +# +$(BIN)/version.txt : $(MAKEDEPS) + $(QM)$(ECHO) " [VERSION] $@" + $(Q)$(ECHO) "$(VERSION)" > $@ + +# Generate release name +# +$(BIN)/relname.txt : $(MAKEDEPS) + $(QM)$(ECHO) " [RELNAME] $@" + $(Q)$(ECHO) "$(RELNAME)" > $@ + +# Generate changelog section +# +$(BIN)/changes.md : ../CHANGELOG.md $(MAKEDEPS) + $(QM)$(ECHO) " [CHANGES] $@" + $(Q)$(PANDOC) -f gfm -t gfm --columns 10000 $< | \ + awk -v RS='\n\n## ' -v marker='$(CLMARKER)' \ + 'index ( $$0, marker ) == 1 { print }' > $@ + $(Q)if [ ! -s $@ ] ; then \ + echo "Missing $(CLMARKER) in $<" >&2 ; \ + exit 1 ; \ + fi + +# Generate release title +# +$(BIN)/reltitle.txt : $(BIN)/changes.md $(MAKEDEPS) + $(QM)$(ECHO) " [RELTITLE] $@" + $(Q)head -1 $< | sed -E \ + 's/^\[(.*)\]\(.+\)\s+(.+)$$/\1 (\2)/; t; s/^\[(.*)\].*$$/\1/' > $@ + +# Generate release notes +# +$(BIN)/relnotes.md : ../RELNOTES.tmpl.md $(BIN)/changes.md $(MAKEDEPS) + $(QM)$(ECHO) " [RELNOTES] $@" + $(Q)( cat ../RELNOTES.tmpl.md ; tail -n +2 $(BIN)/changes.md ) | \ + SRCNAME="$(SRCNAME)" SRCURL="$(SRCURL)" BINURL="$(BINURL)" \ + $(ENVSUBST) '$$SRCNAME $$SRCURL $$BINURL' > $@ + +endif # defined(BIN) + ############################################################################### # # Documentation