diff --git a/.github/workflows/contrib.yml b/.github/workflows/contrib.yml index 1e95316e505..6ab60f96c61 100644 --- a/.github/workflows/contrib.yml +++ b/.github/workflows/contrib.yml @@ -27,8 +27,11 @@ jobs: echo `pwd`/mdbook >> $GITHUB_PATH - name: Deploy docs run: | + GENERATE_PY="$(pwd)/ci/generate.py" + cd src/doc/contrib mdbook build + # Override previous ref to avoid keeping history. git worktree add --orphan -B gh-pages gh-pages git config user.name "Deploy from CI" @@ -36,5 +39,11 @@ jobs: cd gh-pages mv ../book contrib git add contrib + + # Generate HTML for link redirections. + python3 "$GENERATE_PY" + git add *.html + git add CNAME + git commit -m "Deploy $GITHUB_SHA to gh-pages" git push origin +gh-pages diff --git a/ci/generate.py b/ci/generate.py new file mode 100644 index 00000000000..70a7dc1e68d --- /dev/null +++ b/ci/generate.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 + +MAPPING = { + "build-script.html": "https://doc.rust-lang.org/cargo/reference/build-scripts.html", + "config.html": None, + "crates-io.html": "https://doc.rust-lang.org/cargo/reference/publishing.html", + "environment-variables.html": None, + "external-tools.html": None, + "faq.html": "https://doc.rust-lang.org/cargo/faq.html", + "guide.html": "https://doc.rust-lang.org/cargo/guide/", + "index.html": "https://doc.rust-lang.org/cargo/", + "manifest.html": None, + "pkgid-spec.html": None, + "policies.html": "https://crates.io/policies", + "source-replacement.html": None, + "specifying-dependencies.html": None, +} + +TEMPLATE = """\ + +
+ + +