Skip to content

Commit b0dff8c

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

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/docs.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
skip-tests: true
50+
# DOC part
51+
- name: Setup pages
52+
id: pages
53+
uses: actions/configure-pages@v5
54+
- name: Build docs
55+
run: |
56+
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
57+
. install/setup.sh
58+
cd $(colcon list | awk '$1 == "rclrs" { print $2 }')
59+
cargo doc --no-deps
60+
- name: Add redirect
61+
working-directory: ./rclrs
62+
run: echo '<meta http-equiv="refresh" content="0;url=rclrs/index.html">' > target/doc/index.html
63+
- name: Upload artifact
64+
uses: actions/upload-pages-artifact@v3
65+
with:
66+
path: rclrs/target/doc
67+
deploy:
68+
name: Deploy
69+
environment:
70+
name: github-pages
71+
url: ${{ steps.deployment.outputs.page_url }}
72+
runs-on: ubuntu-latest
73+
needs: build
74+
steps:
75+
- name: Deploy to GitHub Pages
76+
id: deployment
77+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)