Repository navigation
86 lines (70 loc) · 1.97 KB
/
Copy pathdocs.yml
File metadata and controls
86 lines (70 loc) · 1.97 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Publish Rust Documentation
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build documentation
run: cargo doc --workspace --no-deps
env:
RUSTDOCFLAGS: -D warnings
- name: Create documentation landing page
shell: bash
run: |
set -euo pipefail
crate_dir="target/doc/pardarsh_core"
if [[ ! -f "$crate_dir/index.html" ]]; then
echo "Expected library documentation not found: $crate_dir/index.html"
exit 1
fi
cat > target/doc/index.html <<'EOF'
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=pardarsh_core/index.html">
<title>Pardarsh Core Documentation</title>
</head>
<body>
<p>
Redirecting to
<a href="pardarsh_core/index.html">Pardarsh Core documentation</a>.
</p>
</body>
</html>
EOF
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: target/doc
deploy:
if: >-
github.event_name != 'pull_request' &&
(github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/master')
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4