-
Notifications
You must be signed in to change notification settings - Fork 264
65 lines (54 loc) · 1.5 KB
/
deploy-ghpages.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy Main to GitHub Pages
on:
push:
branches:
- master
permissions:
contents: write
pages: write
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install mdBook
run: cargo install mdbook
- name: Prepare src directory
run: |
mkdir -p src/vulnerabilities
cp README.md src/README.md
echo "[Introduction](README.md)" > src/SUMMARY.md
cat README.md >> src/SUMMARY.md
cp -r vulnerabilities/* src/vulnerabilities/
- name: Build the book
run: mdbook build
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages
- name: Copy built book to gh-pages
run: |
rm -rf gh-pages/docs
mkdir -p gh-pages/docs
cp -r book/* gh-pages/docs/
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd gh-pages
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
if [ -n "$(git status --porcelain)" ]; then
git add docs
git commit -m 'Deploy new changes'
git push origin gh-pages
else
echo "No changes to commit"
fi