-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (78 loc) · 2.6 KB
/
deploy.yml
File metadata and controls
89 lines (78 loc) · 2.6 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Sample workflow for building and deploying a mdBook site to GitHub Pages
#
# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html
#
name: Deploy
on:
# Runs on pushes targeting the default branch
push:
branches:
- main
- 'ss*'
- 'ws*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.40
steps:
# get the source code
- uses: actions/checkout@v4
# set the site-url for mdBook
- name: Set mdBook site-url
env:
REPO_NAME: ${{ github.event.repository.name }}
run: |
if [ "${{ github.ref_name }}" = "main" ]; then
echo "MDBOOK_OUTPUT__HTML__SITE_URL=/${REPO_NAME}/" >> "$GITHUB_ENV"
else
echo "MDBOOK_OUTPUT__HTML__SITE_URL=/${REPO_NAME}/${{ github.ref_name }}/" >> "$GITHUB_ENV"
fi
# install mdBook and preprocessors
- name: Install mdBook
run: |
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
rustup update
cargo install --version ${MDBOOK_VERSION} mdbook
- name: Install mdBook preprocessors
run: |
cargo install mdbook-admonish --locked --version 1.16.0
mdbook-admonish install .
cargo install mdbook-katex --locked --version 0.9.0
cargo install mdbook-numeq --locked --version 0.3.0
cargo install mdbook-chapter-zero --locked --version 0.1.0
# build the book
- name: Build with mdBook
run: mdbook build
# deploy main branch
- name: Deploy main branch
if: github.ref_name == 'main'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: book
clean: true
clean-exclude: |
ss*
ws*
# deploy archive branche
- name: Deploy archive branches
if: github.ref_name != 'main'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: book
target-folder: ${{ github.ref_name }}
clean: true