Skip to content

Commit 6488886

Browse files
committed
ci: publish rustdoc through the Pages artifact instead of a side-channel gh-pages push
The repo had two different ideas of how GitHub Pages was being published. The rustdoc job was updating a gh-pages branch, while the repo also had a Pages workflow that deployed a separate site artifact. That split makes /docs easy to populate in the branch while the live site continues serving something else entirely. This change makes docs.yml build the complete Pages payload itself: the root page redirects to docs.miden.xyz/miden-vm/ and the generated rustdoc is placed at /docs/. It also removes the older manual redirect-only workflow so there is a single authoritative publisher for the Pages site. Operationally, this only works as intended when the repository Pages source is configured to use GitHub Actions rather than Deploy from a branch. Once that setting is aligned, the workflow output and the public site should finally match.
1 parent d5b1207 commit 6488886

File tree

2 files changed

+38
-79
lines changed

2 files changed

+38
-79
lines changed

.github/workflows/docs.yml

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,57 @@ jobs:
2828
docs:
2929
name: Generate and deploy crate documentation
3030
runs-on: ubuntu-latest
31+
environment:
32+
name: github-pages
33+
url: ${{ steps.deployment.outputs.page_url }}
3134
steps:
3235
- uses: actions/checkout@v4
3336

3437
- name: Cleanup large tools for build space
3538
uses: ./.github/actions/cleanup-runner
3639

40+
- name: Configure GitHub Pages
41+
uses: actions/configure-pages@v5
42+
3743
- name: Generate documentation
3844
run: |
3945
rustup update --no-self-update
4046
rustup default stable
4147
make doc
4248
43-
- name: Prepare publish tree
49+
- name: Prepare GitHub Pages artifact
4450
run: |
4551
set -euo pipefail
46-
mkdir -p .gh-pages-publish/docs
47-
if git ls-remote --heads origin gh-pages | grep -q gh-pages; then
48-
git fetch --depth=1 origin gh-pages
49-
git worktree add --detach .gh-pages-worktree FETCH_HEAD
50-
rsync -a --delete --exclude ".git" .gh-pages-worktree/ .gh-pages-publish/
51-
git worktree remove .gh-pages-worktree --force
52-
fi
53-
rm -rf .gh-pages-publish/docs
54-
mkdir -p .gh-pages-publish/docs
55-
rsync -a --delete target/doc/ .gh-pages-publish/docs/
56-
touch .gh-pages-publish/.nojekyll
52+
mkdir -p _site/docs
5753
58-
- name: Deploy documentation
59-
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # pin@v3
54+
# Publish a single Pages artifact so the live site does not depend on
55+
# whichever Pages source GitHub happens to be configured to read.
56+
cat > _site/index.html << 'EOF'
57+
<!DOCTYPE html>
58+
<html lang="en">
59+
<head>
60+
<meta charset="utf-8">
61+
<title>Redirecting to docs.miden.xyz</title>
62+
<link rel="canonical" href="https://docs.miden.xyz/miden-vm/">
63+
<meta http-equiv="refresh" content="0; url=https://docs.miden.xyz/miden-vm/">
64+
</head>
65+
<body>
66+
<h1>Miden VM Documentation Has Moved</h1>
67+
<p>This site has moved to
68+
<a href="https://docs.miden.xyz/miden-vm/">docs.miden.xyz/miden-vm</a>.
69+
You will be redirected automatically.</p>
70+
</body>
71+
</html>
72+
EOF
73+
74+
rsync -a --delete target/doc/ _site/docs/
75+
touch _site/.nojekyll
76+
77+
- name: Upload GitHub Pages artifact
78+
uses: actions/upload-pages-artifact@v3
6079
with:
61-
github_token: ${{ secrets.GITHUB_TOKEN }}
62-
publish_dir: ./.gh-pages-publish
80+
path: ./_site
81+
82+
- name: Deploy documentation
83+
id: deployment
84+
uses: actions/deploy-pages@v4

.github/workflows/redirect-pages.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)