Thanks for ping.
Today I tried to reproduce the issue and having fresh look figure out what happened.
I haven’t gotten permissions yet to upload so I copied the script except last line:
#!/bin/sh
set -e
dir=$(mktemp -d dist-docs.XXXXXX)
trap 'rm -r "$dir"' EXIT
# assumes cabal 2.4 or later
cabal v2-haddock --builddir="$dir" --haddock-for-hackage --enable-doc
# cabal upload -d --publish $dir/*-docs.tar.gz
trap collects all results on exit via rm and gets stuck when tries to remove some write-protected files generated by cabal, but haddock tar file is removed by that time!
I would use rm with -f to avoid distracting the user with the input.
The last time I tried this (for ghc-exactprint) the upload step failed because of some unsupported curl feature on the server side. I forget the exact details.