Skip to content

Commit 1f8f0b3

Browse files
committed
ci: speed up mdbook build by using pre-built binaries, and remove some superflous comments, run building on every branch, and rsyncing only on pushes to main
1 parent ef21e3c commit 1f8f0b3

2 files changed

Lines changed: 23 additions & 27 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@v6
2121

2222
- name: Setup Node.js
2323
uses: actions/setup-node@v4

.github/workflows/upload-main.yml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,46 @@
1-
# workflow for rendering and uploads webxdc docs
21

3-
name: Render and upload webxdc docs
2+
name: Render docs and upload website to webxdc.org
43

5-
# Controls when the workflow will run
64
on:
7-
# Triggers the workflow on push or pull request events but only for the master branch
85
push:
9-
branches:
10-
- main
11-
12-
# Allows you to run this workflow manually from the Actions tab
6+
branches:
7+
- '**'
8+
pull_request:
139
workflow_dispatch:
1410

15-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1611
jobs:
17-
# This workflow contains a single job called "build"
1812
build:
19-
# The type of runner that the job will run on
2013
runs-on: ubuntu-latest
2114

22-
# Steps represent a sequence of tasks that will be executed as part of the job
2315
steps:
24-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v6
2617

27-
- uses: actions-rs/toolchain@v1
28-
with:
29-
profile: minimal
30-
toolchain: stable
31-
override: true
18+
- name: Download and setup mdbook
19+
run: |
20+
MDBOOK_VERSION="0.4.40"
21+
curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar -xz
22+
sudo mv mdbook /usr/local/bin/
3223
33-
- name: Rust Cache
34-
uses: Swatinem/rust-cache@v1.3.0
24+
# Michael-F-Bryan is the original author, see github link on https://crates.io/crates/mdbook-linkcheck
25+
- name: Install mdbook-linkcheck
26+
run: |
27+
curl -sSL "https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v0.7.7/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip" -o mdbook-linkcheck.zip
28+
unzip mdbook-linkcheck.zip mdbook-linkcheck
29+
chmod +x mdbook-linkcheck
30+
sudo mv mdbook-linkcheck /usr/local/bin/
3531
36-
- name: install mdbook
32+
- name: Build docs and prepare website/ contents
3733
run: |
38-
cargo install mdbook --vers "^0.4"
39-
cargo install mdbook-linkcheck
4034
cd src-docs
4135
mdbook build
4236
mv book/html ../website/docs
37+
cd ..
38+
mv apps website/
4339
44-
- name: Upload website including docs and apps
40+
- name: Upload website/ to webxdc.org
41+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
4542
run: |
4643
mkdir -p "$HOME/.ssh"
4744
echo "${{ secrets.KEY }}" > "$HOME/.ssh/key"
4845
chmod 600 "$HOME/.ssh/key"
49-
mv apps website/
5046
rsync -avzh -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no" "website/" "${{ secrets.USERNAME }}@delta.chat:/var/www/html/webxdc.org"

0 commit comments

Comments
 (0)