hack/register_version.sh only works with GNU sed. On macOS with the stock BSD sed, it fails on one path and silently edits the wrong lines on the other.
Registering a new version inserts the block with the one-line form of a\, which is a GNU extension. BSD sed stops with:
sed: 1: "/^ versions:$/a\ - ...": extra characters after \ at the end of a command
I hit it by running hack/release_next.sh --release-tag v9.9.0 in a scratch copy with /usr/bin/sed first in PATH. The same run with GNU sed passes.
Re-registering an existing version is worse. The range end /^ - version:\|^ [^ ]/ uses \|, and BSD sed does not read that as alternation in a basic regex, so the end never matches and the range runs to the end of hugo.yaml. Every hidden: true and label: line after the target version gets deleted, with no error. A quick check:
printf 'a\n - version: x\nb\n c: 1\n' | /usr/bin/sed -n '/^ - version:\|^ [^ ]/p' # prints nothing
printf 'a\n - version: x\nb\n c: 1\n' | gsed -n '/^ - version:\|^ [^ ]/p' # prints both lines
The release workflow runs on Linux, so CI never sees this. Only a local make release-next on a Mac does. The self-check added in #710 works around it by putting gsed in front of sed.
The script already reads hugo.yaml with yq, so the simplest fix is to do both edits with yq too. The other option is to check for GNU sed at the top and exit with a clear message when it is missing.
hack/register_version.shonly works with GNU sed. On macOS with the stock BSD sed, it fails on one path and silently edits the wrong lines on the other.Registering a new version inserts the block with the one-line form of
a\, which is a GNU extension. BSD sed stops with:I hit it by running
hack/release_next.sh --release-tag v9.9.0in a scratch copy with/usr/bin/sedfirst inPATH. The same run with GNU sed passes.Re-registering an existing version is worse. The range end
/^ - version:\|^ [^ ]/uses\|, and BSD sed does not read that as alternation in a basic regex, so the end never matches and the range runs to the end ofhugo.yaml. Everyhidden: trueandlabel:line after the target version gets deleted, with no error. A quick check:The release workflow runs on Linux, so CI never sees this. Only a local
make release-nexton a Mac does. The self-check added in #710 works around it by puttinggsedin front ofsed.The script already reads
hugo.yamlwith yq, so the simplest fix is to do both edits with yq too. The other option is to check for GNU sed at the top and exit with a clear message when it is missing.