-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (48 loc) · 2.05 KB
/
deploy.yml
File metadata and controls
51 lines (48 loc) · 2.05 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
# Reference: https://github.com/rust-lang/mdBook/wiki/Automated-Deployment:-GitHub-Actions#github-pages-deploy
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install mdbook
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
- name: Install mdbook-admonish
run: |
mkdir mdbook-admonish
curl -sSL https://github.com/tommilligan/mdbook-admonish/releases/download/v1.15.0/mdbook-admonish-v1.15.0-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-admonish
echo `pwd`/mdbook-admonish >> $GITHUB_PATH
- name: Install mdbook-katex
run: |
mkdir mdbook-katex
curl -sSL https://github.com/lzanini/mdbook-katex/releases/download/v0.5.9/mdbook-katex-v0.5.9-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-katex
echo `pwd`/mdbook-katex >> $GITHUB_PATH
- name: Deploy GitHub Pages
run: |
cd book
mdbook build
git worktree add deployed-pages
git config user.name "Deploy from CI"
git config user.email ""
cd deployed-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/deployed-pages
rm -rf *
mv ../book/* .
git add .
git commit -m "Deploy $GITHUB_SHA to deployed-pages"
git push --force --set-upstream origin deployed-pages
# NOTE: `gh-pages` branch was replaced w/ `deployed-pages` b/c GitHub
# had an un-removeable default GHAction on branch "gh-pages" that
# over-wrote pushes from the main branch's deploy action (this script)
# Another note- I wish .yml had ability to have variables to avoid
# hardcoding the "forge-docs-book" directory and branch name "deployed-pages"