You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document explains how the Rust Cookbook is deployed locally by maintainers.
4
+
5
+
## Overview
6
+
7
+
The project uses local deployment scripts to build and deploy to GitHub Pages. This approach allows maintainers to deploy without needing GitHub Actions workflow permissions.
8
+
9
+
## Local Deployment
10
+
11
+
### Deployment Script (`scripts/deploy.sh`)
12
+
13
+
The deployment script handles:
14
+
-**Building**: Builds the mdbook and copies assets
15
+
-**Testing**: Runs cargo tests and spellcheck
16
+
-**Deployment**: Pushes the built site to the `gh-pages` branch
17
+
18
+
### Makefile Commands
19
+
20
+
For convenience, a Makefile provides easy commands:
21
+
22
+
```bash
23
+
make help# Show all available commands
24
+
make build # Build the book locally
25
+
make test# Run all tests
26
+
make dev # Build and test (development workflow)
27
+
make deploy # Deploy to GitHub Pages
28
+
make serve # Serve locally with live reload
29
+
make clean # Clean build artifacts
30
+
```
31
+
32
+
## Local Development
33
+
34
+
For local development and testing:
35
+
36
+
```bash
37
+
# Use the Makefile (recommended)
38
+
make dev
39
+
40
+
# Or run the development script
41
+
./scripts/dev.sh
42
+
43
+
# Or manually:
44
+
cargo install mdbook --vers "0.4.43"
45
+
mdbook build
46
+
cp -r assets/ book/
47
+
cargo test
48
+
./ci/spellcheck.sh list
49
+
```
50
+
51
+
## GitHub Pages Configuration
52
+
53
+
The site is deployed to GitHub Pages from the `gh-pages` branch. The GitHub Actions workflow automatically:
54
+
1. Builds the mdbook to the `book/` directory
55
+
2. Copies assets from `assets/` to `book/`
56
+
3. Pushes the contents to the `gh-pages` branch
57
+
4. GitHub Pages serves the site from this branch
58
+
59
+
## Troubleshooting
60
+
61
+
### Build Failures
62
+
- Check the GitHub Actions logs for specific error messages
63
+
- Ensure all code examples compile and pass tests
64
+
- Verify that all links in the documentation are valid
65
+
66
+
### Deployment Issues
67
+
- Ensure the repository has GitHub Pages enabled in Settings > Pages
68
+
- Check that the `GITHUB_TOKEN` secret is available (this is automatic for public repositories)
69
+
- Verify that the `gh-pages` branch is being created and updated
70
+
71
+
### Local Build Issues
72
+
- Make sure you have Rust and Cargo installed
73
+
- Install mdbook with the exact version: `cargo install mdbook --vers "0.4.43"`
74
+
- Run `cargo clean` if you encounter dependency issues
75
+
76
+
## Migration from Travis CI
77
+
78
+
This setup replaces the previous Travis CI configuration:
79
+
-`ci/deploy.sh` - Replaced by local deployment script (`scripts/deploy.sh`)
80
+
-`ci/test_script.sh` - Functionality integrated into local scripts
81
+
-`appveyor.yml` - Windows testing can be added if needed
82
+
83
+
The new setup provides the same functionality while allowing maintainers to deploy without needing GitHub Actions workflow permissions.
0 commit comments