-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (45 loc) · 1.66 KB
/
generate-docs.yml
File metadata and controls
54 lines (45 loc) · 1.66 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
# This workflow generates docs/index.html from the Rust standard-library source
# using the latest nightly toolchain and pushes any changes back to main.
name: Generate docs/index.html
on:
push:
branches:
- main
schedule:
- cron: '0 2 * * *'
# Allow manual runs from the Actions tab.
workflow_dispatch:
permissions:
contents: write
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install the latest nightly toolchain together with rust-src so the
# extract_public_unsafe.py script can find the sysroot sources.
- name: Install Rust nightly with rust-src
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rust-src
# Keep nightly up-to-date and make sure rust-src is still present after
# the update (rustup update can drop optional components).
- name: Update nightly and ensure rust-src is available
run: |
rustup update nightly
rustup component add rust-src --toolchain nightly
- name: Generate docs/index.html
run: python3 scripts/extract_public_unsafe.py docs/index.html
- name: Commit and push docs
run: |
git config --global user.email 'action@github.com'
git config --global user.name 'GitHub Action'
git remote set-url origin https://${{ secrets.GITHUB_TOKEN }}@github.com/safer-rust/std-unsafe-doc.git
git add -A docs/
git commit -m 'Update docs [ci skip]' || echo 'No changes to commit'
git pull --rebase origin main
git push