Repository navigation
59 lines (51 loc) · 1.65 KB
/
Copy pathdocs.yml
File metadata and controls
59 lines (51 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Documentation
on:
push:
branches: [ "master" ]
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Build documentation
run: cargo doc --no-deps
- name: Prepare docs directory
run: |
# Remove old docs directory if it exists
rm -rf docs
# Create docs directory
mkdir -p docs
# Copy generated documentation
cp -r target/doc/* docs/
# Create a redirect index.html at root that points to the crate docs
cat > docs/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=runecast_protocol/index.html">
<title>Redirecting to runecast_protocol documentation</title>
</head>
<body>
<p>Redirecting to <a href="runecast_protocol/index.html">runecast_protocol documentation</a>...</p>
</body>
</html>
EOF
# Create .nojekyll to prevent GitHub Pages from ignoring files starting with underscore
touch docs/.nojekyll
- name: Commit and push documentation
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/
git diff --staged --quiet || git commit -m "Update documentation"
git push