Skip to content

Commit 748ae33

Browse files
committed
Add GHA for publishing mdbook
1 parent 02f3c8d commit 748ae33

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/docs.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'README.md'
9+
- 'docs/**'
10+
- '.github/workflows/docs.yml'
11+
pull_request:
12+
paths:
13+
- 'docs/**'
14+
- '.github/workflows/docs.yml'
15+
16+
permissions:
17+
contents: read
18+
pages: write # to deploy to Pages
19+
id-token: write # to verify the deployment originates from an appropriate source
20+
21+
jobs:
22+
generate-docs:
23+
runs-on: ubuntu-latest
24+
container: docker.io/node:20-bullseye-slim
25+
timeout-minutes: 2
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Setup mdBook
30+
run: |
31+
apt-get update
32+
apt-get install curl -y
33+
mkdir mdbook
34+
curl -sSL https://github.com/rust-lang/mdbook/releases/download/v0.4.37/mdbook-v0.4.37-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
35+
curl -sSL https://github.com/tommilligan/mdbook-admonish/releases/download/v1.15.0/mdbook-admonish-v1.15.0-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
36+
echo `pwd`/mdbook >> $GITHUB_PATH
37+
38+
- name: Build with mdBook
39+
run: |
40+
cd docs
41+
mdbook build
42+
43+
- name: Setup Pages
44+
uses: actions/configure-pages@v5
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: 'docs/book'
50+
51+
deploy-page:
52+
needs: generate-docs
53+
if: github.event_name == 'push'
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
runs-on: ubuntu-latest
58+
timeout-minutes: 2
59+
steps:
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v4

docs/book.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ description = "Documentation for the Kubernetes Cloud Controller Manager for Lin
88

99
[output.html]
1010
git-repository-url = "https://github.com/linode/linode-cloud-controller-manager"
11+
site-url = "/linode-cloud-controller-manager/"
12+
edit-url-template = "https://github.com/linode/linode-cloud-controller-manager/edit/master/docs/{path}"
13+
14+
[preprocessor]
15+
16+
[preprocessor.admonish]
17+
command = "mdbook-admonish"
18+
assets_version = "3.0.2" # do not edit: managed by `mdbook-admonish install`
1119

1220
[output.html.playground]
1321
editable = true

0 commit comments

Comments
 (0)