Skip to content

Commit c0d0f5a

Browse files
authored
Location block for /matrix/media (#23)
Also rewrote the CI to use better caching without relying on Docker
1 parent c9c6928 commit c0d0f5a

File tree

10 files changed

+304
-216
lines changed

10 files changed

+304
-216
lines changed

Diff for: .github/workflows/build-docker.yml

-38
This file was deleted.

Diff for: .github/workflows/deploy-mdbook.yml

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
name: Deploy mdBook Site to Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
workflow_dispatch:
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
SCCACHE_VERSION: "0.9.0"
12+
MDBOOK_VERSION: "0.4.43"
13+
MDBOOK_ADMONISH_VERSION: "1.15.0"
14+
MDBOOK_GRAPHVIZ_VERSION: "0.2.1"
15+
MDBOOK_MERMAID_VERSION: "0.13.0"
16+
17+
permissions:
18+
contents: read
19+
id-token: write
20+
pages: write
21+
22+
concurrency:
23+
group: pages
24+
cancel-in-progress: true
25+
26+
jobs:
27+
build-deps:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout Source
31+
uses: actions/checkout@v4
32+
33+
- name: Install Rust
34+
uses: dtolnay/rust-toolchain@stable
35+
36+
- uses: actions/cache@v4
37+
with:
38+
path: |
39+
~/.cargo/bin
40+
~/.cargo/git
41+
~/.cargo/registry
42+
target
43+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
44+
45+
- name: Check for existing mdbook-footnote
46+
id: check-footnote
47+
run: |
48+
if [ -f ~/.cargo/bin/mdbook-footnote ]; then
49+
echo "exists=true" >> $GITHUB_OUTPUT
50+
echo "mdbook-footnote binary found, will skip build"
51+
else
52+
echo "exists=false" >> $GITHUB_OUTPUT
53+
echo "mdbook-footnote binary not found, will build"
54+
fi
55+
56+
- name: Build mdbook-footnote
57+
if: steps.check-footnote.outputs.exists != 'true'
58+
run: cargo install mdbook-footnote
59+
60+
- name: Check for existing mdbook-graphviz
61+
id: check-graphviz
62+
run: |
63+
if [ -f ~/.cargo/bin/mdbook-graphviz ]; then
64+
echo "exists=true" >> $GITHUB_OUTPUT
65+
echo "mdbook-graphviz binary found, will skip build"
66+
else
67+
echo "exists=false" >> $GITHUB_OUTPUT
68+
echo "mdbook-graphviz binary not found, will build"
69+
fi
70+
71+
- name: Build mdbook-graphviz
72+
if: steps.check-graphviz.outputs.exists != 'true'
73+
run: cargo install mdbook-graphviz --version ${MDBOOK_GRAPHVIZ_VERSION}
74+
75+
- name: Upload Binaries
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: mdbook-plugins
79+
path: |
80+
~/.cargo/bin/mdbook-footnote
81+
~/.cargo/bin/mdbook-graphviz
82+
retention-days: 1
83+
84+
deploy-mdbook:
85+
needs: build-deps
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Checkout Source
89+
uses: actions/checkout@v4
90+
91+
- name: Install System Dependencies
92+
env:
93+
DEBIAN_FRONTEND: noninteractive
94+
run: |
95+
sudo apt-get update
96+
sudo apt-get install -y --no-install-recommends graphviz
97+
98+
- name: Install mdBook
99+
run: |
100+
wget -qO mdbook.tar.gz \
101+
"https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
102+
sudo tar xf mdbook.tar.gz -C /usr/local/bin
103+
rm -rf mdbook.tar.gz
104+
105+
- name: Install mdbook-admonish
106+
run: |
107+
wget -qO admonish.tar.gz \
108+
"https://github.com/tommilligan/mdbook-admonish/releases/download/v${MDBOOK_ADMONISH_VERSION}/mdbook-admonish-v${MDBOOK_ADMONISH_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
109+
sudo tar xf admonish.tar.gz -C /usr/local/bin
110+
rm -rf admonish.tar.gz
111+
112+
- name: Download mdbook plugins
113+
uses: actions/download-artifact@v4
114+
with:
115+
name: mdbook-plugins
116+
path: /usr/local/bin
117+
118+
- name: Make plugins executable
119+
run: |
120+
sudo chmod +x /usr/local/bin/mdbook-footnote
121+
sudo chmod +x /usr/local/bin/mdbook-graphviz
122+
123+
- name: Install mdbook-mermaid
124+
run: |
125+
wget -qO mermaid.tar.gz \
126+
"https://github.com/badboy/mdbook-mermaid/releases/download/v${MDBOOK_MERMAID_VERSION}/mdbook-mermaid-v${MDBOOK_MERMAID_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
127+
sudo tar xf mermaid.tar.gz -C /usr/local/bin
128+
rm -rf mermaid.tar.gz
129+
130+
- name: Prepare Assets Directories
131+
run: mkdir -p src/fonts src/assets theme
132+
133+
- name: Setup Catppuccin Theme
134+
run: |
135+
# Create theme directory
136+
mkdir -p theme
137+
138+
# Download latest Catppuccin theme
139+
curl -sSfL -o theme/catppuccin.css \
140+
https://github.com/catppuccin/mdBook/releases/latest/download/catppuccin.css
141+
142+
# Download Catppuccin admonish theme
143+
curl -sSfL -o theme/catppuccin-admonish.css \
144+
https://github.com/catppuccin/mdBook/releases/latest/download/catppuccin-admonish.css
145+
146+
# Download default theme's index.hbs for customization
147+
curl -sSfL -o theme/index.hbs \
148+
https://raw.githubusercontent.com/rust-lang/mdBook/master/src/theme/index.hbs
149+
150+
# Update index.hbs theme options
151+
sed -i 's/Light/Latte/; s/Rust/Frappé/; s/Coal/Macchiato/; s/Navy/Mocha/; /Ayu/d' theme/index.hbs
152+
153+
- name: Download Additional Assets
154+
run: |
155+
# Devicon Fonts and CSS
156+
curl -sSf \
157+
-o devicon.min.css \
158+
https://raw.githubusercontent.com/devicons/devicon/master/devicon.min.css
159+
curl -sSf \
160+
-o src/fonts/devicon.eot \
161+
https://raw.githubusercontent.com/devicons/devicon/master/fonts/devicon.eot
162+
curl -sSf \
163+
-o src/fonts/devicon.svg \
164+
https://raw.githubusercontent.com/devicons/devicon/master/fonts/devicon.svg
165+
curl -sSf \
166+
-o src/fonts/devicon.ttf \
167+
https://raw.githubusercontent.com/devicons/devicon/master/fonts/devicon.ttf
168+
curl -sSf \
169+
-o src/fonts/devicon.woff \
170+
https://raw.githubusercontent.com/devicons/devicon/master/fonts/devicon.woff
171+
172+
# WhichLang Assets
173+
curl -sSf \
174+
-o src/assets/whichlang.css \
175+
https://raw.githubusercontent.com/phoenixr-codes/mdbook-whichlang/master/src/whichlang.css
176+
curl -sSf \
177+
-o src/assets/whichlang.js \
178+
https://raw.githubusercontent.com/phoenixr-codes/mdbook-whichlang/master/dist/whichlang.js
179+
180+
- name: Build the mdBook Site
181+
run: mdbook build
182+
183+
- name: Turn off Jekyll
184+
run: touch book/.nojekyll
185+
186+
- name: Upload Artifact
187+
uses: actions/upload-pages-artifact@v3
188+
with:
189+
path: ./book
190+
191+
- name: Deploy to GitHub Pages
192+
id: deployment
193+
uses: actions/deploy-pages@v4
194+
if: ${{ github.ref == 'refs/heads/main' }}

Diff for: .github/workflows/update-mdbook.yml

-116
This file was deleted.

0 commit comments

Comments
 (0)