Skip to content

Commit 60bde37

Browse files
committed
feat: implement reusable Rust setup action with caching
1 parent 2993cf4 commit 60bde37

8 files changed

Lines changed: 45 additions & 42 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Setup Rust"
2+
description: "Setup Rust toolchain with caching"
3+
inputs:
4+
target:
5+
description: "Target triple to install"
6+
required: false
7+
default: ""
8+
toolchain:
9+
description: "Rust toolchain to install"
10+
required: false
11+
default: "stable"
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Cache Cargo
17+
uses: actions/cache@v4
18+
with:
19+
path: |
20+
~/.cargo/bin/
21+
~/.cargo/registry/index/
22+
~/.cargo/registry/cache/
23+
target/
24+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
25+
restore-keys: ${{ runner.os }}-cargo-
26+
27+
- name: Install Rust toolchain
28+
uses: actions-rs/toolchain@v1
29+
with:
30+
override: true
31+
toolchain: ${{ inputs.toolchain }}
32+
target: ${{ inputs.target }}

.github/workflows/page.yaml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,8 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@master
1616

17-
- name: Cahce
18-
uses: actions/cache@v4
19-
with:
20-
path: |
21-
~/.cargo/bin/
22-
~/.cargo/registry/index/
23-
~/.cargo/registry/cache/
24-
target/
25-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
26-
restore-keys: ${{ runner.os }}-cargo-
27-
28-
- name: Setup toolchain
29-
uses: actions-rs/toolchain@v1
30-
with:
31-
toolchain: stable
32-
override: true
17+
- name: Setup Rust
18+
uses: ./.github/actions/setup-rust
3319

3420
- name: Test
3521
run: cargo test --all-features --verbose

.github/workflows/release.yaml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@master
1212

13-
- name: Install toolchain
14-
uses: actions-rs/toolchain@v1
15-
with:
16-
override: true
17-
toolchain: stable
13+
- name: Setup Rust
14+
uses: ./.github/actions/setup-rust
1815

1916
- name: Run tests
2017
run: cargo test --all-features --verbose
2118

2219
build:
20+
needs: test
2321
strategy:
2422
fail-fast: true
2523
matrix:
@@ -35,22 +33,9 @@ jobs:
3533
steps:
3634
- uses: actions/checkout@master
3735

38-
- name: Cahce
39-
uses: actions/cache@v3
40-
with:
41-
path: |
42-
~/.cargo/bin/
43-
~/.cargo/registry/index/
44-
~/.cargo/registry/cache/
45-
target/
46-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
47-
restore-keys: ${{ runner.os }}-cargo-
48-
49-
- name: Install toolchain
50-
uses: actions-rs/toolchain@v1
36+
- name: Setup Rust
37+
uses: ./.github/actions/setup-rust
5138
with:
52-
override: true
53-
toolchain: stable
5439
target: ${{ matrix.target }}
5540

5641
- name: Build release

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mdbook-embedify"
3-
version = "0.2.17-rc.3"
3+
version = "0.2.17-rc.4"
44
edition = "2021"
55
license = "MIT"
66
readme = "README.md"

docs/assets/js/patch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function appendVersion() {
22
const shield = document.createElement("span");
3-
shield.textContent = "0.2.17-rc.3";
3+
shield.textContent = "0.2.17-rc.4";
44
document.querySelector(".menu-title").appendChild(shield);
55
}
66

docs/book.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ footer.enable = true
5151
footer.message = "Copyright © 2025 • Created with ❤️ by [MR-Addict](https://github.com/MR-Addict)"
5252

5353
announcement-banner.enable = true
54-
announcement-banner.id = "0.2.17-rc.3"
55-
announcement-banner.message = "*Version **0.2.17-rc.3** now has relased, check it out [here](https://github.com/MR-Addict/mdbook-embedify/releases/tag/0.2.17-rc.3).*"
54+
announcement-banner.id = "0.2.17-rc.4"
55+
announcement-banner.message = "*Version **0.2.17-rc.4** now has relased, check it out [here](https://github.com/MR-Addict/mdbook-embedify/releases/tag/0.2.17-rc.4).*"
5656

5757
giscus.enable = true
5858
giscus.repo = "MR-Addict/mdbook-embedify"

docs/src/local/announcement-banner.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Announcement banner allows you put important messages at the top of the page. It
1414
<!-- embed ignore begin -->
1515

1616
```text
17-
{% embed announcement-banner id="0.2.17-rc.3" message="*Version **0.2.17-rc.3** now has relased, check it out [here](https://github.com/MR-Addict/mdbook-embedify/releases/tag/0.2.17-rc.3).*" %}
17+
{% embed announcement-banner id="0.2.17-rc.4" message="*Version **0.2.17-rc.4** now has relased, check it out [here](https://github.com/MR-Addict/mdbook-embedify/releases/tag/0.2.17-rc.4).*" %}
1818
```
1919

2020
<!-- embed ignore end -->

0 commit comments

Comments
 (0)