-
Notifications
You must be signed in to change notification settings - Fork 78
47 lines (45 loc) · 1.82 KB
/
manual-book.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# SPDX-FileCopyrightText: 2022 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
# SPDX-FileContributor: Andrew Hayzen <[email protected]>
#
# SPDX-License-Identifier: MIT OR Apache-2.0
name: manually deploy book
# Allow deploying the book manually from any branch
on: workflow_dispatch
jobs:
book:
runs-on: ubuntu-latest
# Keep in sync with book.yml
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install mdbook and mdbook-linkcheck from binaries
run: |
mkdir mdbook
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.36/mdbook-v0.4.36-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
curl -sSL https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip -o mdbook-linkcheck.zip
unzip mdbook-linkcheck.zip -d mdbook-linkcheck/
rm mdbook-linkcheck.zip
chmod +x ./mdbook-linkcheck/mdbook-linkcheck
echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH
- name: Deploy GitHub Pages
run: |
# This assumes your book is in the root of your repository.
# Just add a `cd` here if you need to change to another directory.
cd book/
mdbook build
git worktree add gh-pages gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
# We want the book to be in it's own folder
mkdir book/
# We want only the html directory not the linkcheck one
mv ../book/html/* book/
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force