mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 14:01:20 -03:00
release workflow: resolve relative references in changelog properly
Instead of having sphinx-build only build CHANGELOG.rst, build the
entire thing, so relative references (":doc:", ":ref:") can be resolved
properly. Replace our sed-based hacks with 'markdown_http_base'.
This commit is contained in:
@@ -5,27 +5,37 @@ set -e
|
||||
workspace_root=$(dirname "$0")/..
|
||||
|
||||
relnotes_tmp=$(mktemp -d)
|
||||
mkdir "$relnotes_tmp/src" "$relnotes_tmp/out"
|
||||
mkdir -p "$relnotes_tmp/fake-workspace" "$relnotes_tmp/out"
|
||||
(
|
||||
cd "$workspace_root"
|
||||
cp -r doc_src CONTRIBUTING.rst README.rst "$relnotes_tmp/fake-workspace"
|
||||
)
|
||||
version=$(sed 's,^fish \(\S*\) .*,\1,; 1q' "$workspace_root/CHANGELOG.rst")
|
||||
minor_version=${version%.*}
|
||||
changelog_for_this_version=$(awk <"$workspace_root/CHANGELOG.rst" '
|
||||
/^===/ { if (v++) { exit } }
|
||||
{ print }
|
||||
' | sed '$d')
|
||||
# Also fix up any relative references to other documentation files.
|
||||
# Also remove spurious transitions at the end of the document.
|
||||
' | sed '$d'
|
||||
)
|
||||
# Remove spurious transitions at the end of the document.
|
||||
printf %s "$changelog_for_this_version" |
|
||||
sed >"$relnotes_tmp/src"/index.rst \
|
||||
-e 's,:doc:`\(.*\) <\([^>]*\)>`,`\1 <https://fishshell.com/docs/'"$minor_version"'/\2.html>`_,g' \
|
||||
-e 's,:envvar:`\([^`]*\)`,``$\1``,g' \
|
||||
-e '$s/^----*$//'
|
||||
sed -e '$s/^----*$//' >"$relnotes_tmp/fake-workspace"/CHANGELOG.rst
|
||||
|
||||
# Use "-j 1" because sphinx-markdown-builder is not marked concurrency-safe.
|
||||
sphinx-build >&2 -j 1 \
|
||||
-W -E -b markdown -c "$workspace_root/doc_src" \
|
||||
-d "$relnotes_tmp/doctree" "$relnotes_tmp/src" $relnotes_tmp/out "$@"
|
||||
-d "$relnotes_tmp/doctree" "$relnotes_tmp/fake-workspace/doc_src" $relnotes_tmp/out \
|
||||
-D markdown_http_base="https://fishshell.com/docs/$minor_version" \
|
||||
-D markdown_uri_doc_suffix=".html" \
|
||||
"$@"
|
||||
|
||||
# Delete changelog header
|
||||
sed -n 1p "$relnotes_tmp/out/relnotes.md" | grep -Fxq "# Release notes"
|
||||
sed -n 2p "$relnotes_tmp/out/relnotes.md" | grep -Fxq ''
|
||||
sed -i 1,2d "$relnotes_tmp/out/relnotes.md"
|
||||
|
||||
{
|
||||
cat "$relnotes_tmp/out/index.md" - <<EOF
|
||||
cat "$relnotes_tmp/out/relnotes.md" - <<EOF
|
||||
|
||||
--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user