ci: separate docs into scripts
CI / check (push) Successful in 8m52s
Deploy docs / deploy (push) Failing after 1m50s
Nightly / nightly (push) Successful in 10m54s

This commit is contained in:
2026-08-07 16:54:59 -04:00
parent abc0bdf621
commit 717c4b412a
4 changed files with 67 additions and 34 deletions
+5 -34
View File
@@ -16,35 +16,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Write the channel switcher
run: |
cat > "${{ gitea.workspace }}/docs-banner.html" <<'HTML'
<div style="padding:.4rem .75rem;font:0.85rem/1.4 sans-serif;border-bottom:1px solid var(--border-color,#ddd);background:var(--sidebar-background-color,#f7f7f7);color:var(--main-color,#000)">
Docs channel:
<a id="ch-release" href="#" style="margin:0 .35rem">release</a>|
<a id="ch-nightly" href="#" style="margin:0 .35rem">nightly</a>
<script>
(function () {
var m = location.pathname.match(/^(.*\/)(release|nightly)\//);
var base = m ? m[1] : location.pathname.replace(/[^\/]*$/, "");
document.getElementById("ch-release").href = base + "release/";
document.getElementById("ch-nightly").href = base + "nightly/";
if (m) { document.getElementById("ch-" + m[2]).style.fontWeight = "bold"; }
})();
</script>
</div>
HTML
- name: Build the API docs
env:
RUSTDOCFLAGS: "--html-before-content ${{ gitea.workspace }}/docs-banner.html"
RUSTDOCFLAGS: "--html-before-content ${{ gitea.workspace }}/scripts/docs-banner.html"
run: |
pixi install --locked
pixi run doc-build
- name: Redirect the channel root to the crate page
run: |
printf '%s\n' "<!doctype html><meta http-equiv=\"refresh\" content=\"0; url=${CRATE}/\">" > target/doc/index.html
- name: Flatten so the crate sits at the channel root
run: bash scripts/flatten-docs.sh
- name: Publish the channel to /srv/www
run: |
@@ -52,16 +32,7 @@ jobs:
refs/tags/*) channel=release ;;
*) channel=nightly ;;
esac
dest="/srv/www/${SITE_SLUG}/${channel}"
mkdir -p "$dest"
rsync -a --delete "target/doc/" "$dest/"
bash scripts/publish-docs.sh "$channel"
- name: Point the site root at the latest release, else nightly
run: |
root="/srv/www/${SITE_SLUG}"
if [ -d "$root/release/${CRATE}" ]; then
target="release/${CRATE}/"
else
target="nightly/${CRATE}/"
fi
printf '%s\n' "<!doctype html><meta http-equiv=\"refresh\" content=\"0; url=${target}\">" > "$root/index.html"
run: bash scripts/redirect-docs.sh