Skip to content

Commit 4dd5cb6

Browse files
Update rust.yml
1 parent 846d4b7 commit 4dd5cb6

1 file changed

Lines changed: 28 additions & 24 deletions

File tree

.github/workflows/rust.yml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
1-
name: Rust Test and Deplou to GitHub Pages
1+
name: Deploy Rust Docs
22

33
on:
44
push:
55
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
88

99
permissions:
1010
contents: read
1111
pages: write
1212
id-token: write
13-
env:
14-
CARGO_TERM_COLOR: always
1513

1614
jobs:
17-
build:
18-
15+
build-and-deploy:
1916
runs-on: ubuntu-latest
20-
2117
steps:
22-
- uses: actions/checkout@v4
23-
- name: Build
24-
run: cargo build --verbose
25-
- name: Run tests
26-
run: cargo test --verbose
27-
- name: Generate Documentation
28-
run: cargo doc --no-deps --document-private-items
29-
- name: Setup Pages
30-
uses: actions/configure-pages@v4
31-
- name: Upload Artifact
32-
uses: actions/upload-pages-artifact@v3
33-
with:
34-
# Path to the generated docs
35-
path: target/doc
36-
- name: Deploy to GitHub Pages
37-
uses: actions/deploy-pages@v4
18+
- name: Checkout Repository
19+
uses: actions/checkout@v4
20+
21+
- name: Install Rust
22+
uses: dtolnay/rust-toolchain@stable
23+
24+
- name: Generate Documentation
25+
run: cargo doc --no-deps --document-private-items
26+
27+
- name: Create Root Redirect
28+
# This prevents the 404 by pointing the root to your crate's folder
29+
run: |
30+
echo '<meta http-equiv="refresh" content="0; url=web_server_made_rusty/index.html">' > target/doc/index.html
31+
32+
- name: Fix Permissions
33+
run: chmod -v -R +rX "target/doc/"
34+
35+
- name: Upload Artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: target/doc
39+
40+
- name: Deploy to GitHub Pages
41+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)