forked from ariel-os/ariel-os
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (129 loc) · 4.33 KB
/
build-deploy-docs.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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Deploy docs
# GitHub Action workflow documentation:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
# This workflow is based on
# https://github.com/actions/starter-workflows/blob/main/pages/mdbook.yml
on:
push:
branches: main
paths:
- book/**
- src/**
- Cargo.toml
- rust-toolchain.toml
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
if: github.repository == 'ariel-os/ariel-os'
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- id: get_toolchain
run: echo "toolchain=$(scripts/rust-toolchain.sh)" >> $GITHUB_OUTPUT
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.get_toolchain.outputs.toolchain }}
# Docs of HAL crates must be generated after that of the main crate,
# otherwise this would result in broken links, as they use `--no-deps` for
# faster generation.
- name: Build rustdoc docs
run: |
cargo doc \
-p ariel-os \
--features "
bench,
coap,
csprng,
executor-thread,
external-interrupts,
hwrng,
i2c,
net,
no-boards,
random,
ariel-os-coap/doc,
spi,
storage,
threading,
usb,
usb-hid,
"
RUSTDOCFLAGS='-D warnings --cfg context="esp32c6"' cargo doc \
--target=riscv32imac-unknown-none-elf \
--no-deps \
--features "
esp-hal-embassy/esp32c6,
esp-hal/esp32c6,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-esp
RUSTDOCFLAGS='-D warnings --cfg context="rp2040"' cargo doc \
--no-deps \
--features "
embassy-rp/rp2040,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-rp
RUSTDOCFLAGS='-D warnings --cfg context="nrf52840"' cargo doc \
--no-deps \
--features "
embassy-nrf/nrf52840,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-nrf
RUSTDOCFLAGS='-D warnings --cfg context="stm32wb55rgvx"' cargo doc \
--no-deps \
--features "
embassy-stm32/stm32wb55rg,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-stm32
echo "<meta http-equiv=\"refresh\" content=\"0; url=ariel_os\">" > target/doc/index.html
mkdir -p ./_site/dev/docs/api
mv target/riscv32imac-unknown-none-elf/doc/ariel_os_esp/ ./_site/dev/docs/api
mv target/doc/* ./_site/dev/docs/api
- name: Install mdbook
run: |
mkdir mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.36/mdbook-v0.4.36-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Build the book
run: |
cd book
mdbook build
mv book ../_site/dev/docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4