Skip to content

Commit 40236a9

Browse files
committed
update CI workflow for mdBook deployment and correct book title in configuration
1 parent e75d687 commit 40236a9

File tree

2 files changed

+39
-42
lines changed

2 files changed

+39
-42
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,53 @@
1-
name: CI
1+
name: Deploy mdBook site to Pages
22

33
on:
4-
push: # Run CI for all branches except GitHub merge queue tmp branches
5-
branches-ignore:
6-
- "gh-readonly-queue/**"
7-
pull_request: # Run CI for PRs on any branch
8-
merge_group: # Run CI for the GitHub merge queue
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
917

1018
jobs:
19+
# Build job
1120
build:
12-
runs-on: ubuntu-24.04
21+
runs-on: ubuntu-latest
1322
steps:
1423
- uses: actions/checkout@v4
15-
- uses: dtolnay/rust-toolchain@stable
16-
24+
- name: Install mdbook
25+
run: |
26+
mkdir bin
27+
curl -sSL https://github.com/RustLangES/mdBook/releases/download/v0.4.36-localization-v0.6/mdbook-v0.4.36-localization-v0.6-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
28+
echo "$(pwd)/bin" >> ${GITHUB_PATH}
29+
- name: Build with mdBook
30+
run: mdbook build
1731
- name: Install Python dependencies
1832
run: |
1933
pip3 install --user python-dateutil linkchecker
2034
- name: Put pip binary directory into path
2135
run: echo "~/.local/bin" >> $GITHUB_PATH
22-
23-
- name: Cache Cargo installed binaries
24-
uses: actions/cache@v4
25-
id: cache-cargo
26-
with:
27-
path: ~/cargo-bin
28-
key: cache-cargo
29-
- name: Install mdbook
30-
if: steps.cache-cargo.outputs.cache-hit != 'true'
31-
uses: actions-rs/install@v0.1
32-
with:
33-
crate: mdbook
34-
version: latest
35-
- name: Copy mdbook to cache directory
36-
if: steps.cache-cargo.outputs.cache-hit != 'true'
37-
run: |
38-
mkdir ~/cargo-bin
39-
cp ~/.cargo/bin/mdbook ~/cargo-bin
40-
- name: Put new cargo binary directory into path
41-
run: echo "~/cargo-bin" >> $GITHUB_PATH
42-
43-
- name: Build book
44-
run: mdbook build
45-
- name: Test book
46-
run: mdbook test
4736
- name: Check links
4837
run: linkchecker book
38+
- name: Upload artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
path: ./book
4942

50-
- name: Deploy book
51-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
52-
uses: peaceiris/actions-gh-pages@v3
43+
deploy:
44+
runs-on: ubuntu-latest
45+
needs: build
46+
steps:
47+
- uses: actions/download-artifact@v4
48+
- name: Deploy
49+
uses: cloudflare/wrangler-action@v3
5350
with:
54-
github_token: ${{ secrets.GITHUB_TOKEN }}
55-
publish_dir: book
56-
force_orphan: true
51+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
52+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
53+
command: pages deploy ./artifact --project-name=embedded

book.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[book]
22
authors = ["James Munns"]
33
src = "src"
4-
title = "The Embedded Rust Book"
4+
title = "El libro de Rust Embebido"
55

66
[output.html]
7-
git-repository-url = "https://github.com/rust-embedded/book"
7+
git-repository-url = "https://github.com/RustLangES/rust-embedded-book"

0 commit comments

Comments
 (0)