Skip to content

Commit 265c017

Browse files
Add a GH workflow to build and deploy doc on GH pages
1 parent c463201 commit 265c017

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/docs.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Docs
2+
on:
3+
push:
4+
branches: [feature/add_doc_job]
5+
permissions:
6+
contents: read
7+
pages: write
8+
id-token: write
9+
concurrency:
10+
group: deploy
11+
cancel-in-progress: false
12+
env:
13+
CARGO_TERM_COLOR: always
14+
jobs:
15+
build:
16+
name: Build
17+
runs-on: ubuntu-latest
18+
container: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
# ROS 2 WS part
23+
- name: Search packages in this repository
24+
id: list_packages
25+
run: |
26+
{
27+
echo 'package_list<<EOF'
28+
colcon list --names-only
29+
echo EOF
30+
} >> "$GITHUB_OUTPUT"
31+
- name: Setup ROS environment
32+
uses: ros-tooling/[email protected]
33+
with:
34+
required-ros-distributions: rolling
35+
- name: Setup Rust
36+
uses: dtolnay/rust-toolchain@stable
37+
with:
38+
components: clippy, rustfmt
39+
- name: Install colcon-cargo and colcon-ros-cargo
40+
run: |
41+
sudo pip3 install git+https://github.com/colcon/colcon-cargo.git
42+
sudo pip3 install git+https://github.com/colcon/colcon-ros-cargo.git
43+
- name: Build ROS 2 WS
44+
uses: ros-tooling/[email protected]
45+
with:
46+
package-name: ${{ steps.list_packages.outputs.package_list }}
47+
target-ros2-distro: rolling
48+
vcs-repo-file-url: ros2_rust_rolling.repos
49+
# DOC part
50+
- name: Setup pages
51+
id: pages
52+
uses: actions/configure-pages@v5
53+
- name: Build docs
54+
working-directory: ./rclrs
55+
run: |
56+
source ${{ steps.build.outputs.ros-workspace-directory-name }}/install/setup.bash
57+
cargo doc --no-deps
58+
- name: Add redirect
59+
working-directory: ./rclrs
60+
run: echo '<meta http-equiv="refresh" content="0;url=rclrs/index.html">' > target/doc/index.html
61+
- name: Upload artifact
62+
uses: actions/upload-pages-artifact@v3
63+
with:
64+
path: rclrs/target/doc
65+
deploy:
66+
name: Deploy
67+
environment:
68+
name: github-pages
69+
url: ${{ steps.deployment.outputs.page_url }}
70+
runs-on: ubuntu-latest
71+
needs: build
72+
steps:
73+
- name: Deploy to GitHub Pages
74+
id: deployment
75+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)