-
Notifications
You must be signed in to change notification settings - Fork 10
59 lines (49 loc) · 1.68 KB
/
documentation.yml
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: Cargo Create Docs
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
jobs:
build-rust-doc:
name: Zombienet SDK - Rust Docs
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
# TODO 24-02-08: Disable nightly due to tkaitchuck/aHash#200.
#- nightly
- stable
steps:
- uses: actions/checkout@v3
- name: Init nigthly install for fmt
run: rustup update nightly && rustup default nightly && rustup component add rustfmt
- name: Check format
run: cargo +nightly fmt --check --all
- name: Init install
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} && rustup component add clippy
- name: Create docs
run: |
cargo doc --no-deps
echo "<meta http-equiv=\"refresh\" content=\"0; url=zombienet_sdk\">" > target/doc/index.html
- name: Move docs
run: |
mkdir -p ./doc
mv ./target/doc/* ./doc
git config user.email "[email protected]"
git config user.name "GitHub Action"
git config user.password "${{ secrets.GH_PAGES_TOKEN }}"
git checkout --orphan gh-pages
mkdir to_delete
shopt -s extglob
mv !(to_delete) ./to_delete
mv ./to_delete/doc/* .
rm -rf ./to_delete
git add --all
git commit -m "Documentation"
shell: bash # Necessary for `shopt` to work
- run: git push -f origin gh-pages:gh-pages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}