Skip to content

Commit a6c9dea

Browse files
added gh-pages deployment script to CI
1 parent 9c46ebe commit a6c9dea

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
- name: Install mdbook
15+
run: |
16+
mkdir mdbook
17+
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
18+
echo `pwd`/mdbook >> $GITHUB_PATH
19+
- name: Deploy GitHub Pages
20+
run: |
21+
mdbook build
22+
git worktree add gh-pages
23+
git config user.name "Deploy from CI"
24+
git config user.email ""
25+
cd gh-pages
26+
# Delete the ref to avoid keeping history.
27+
git update-ref -d refs/heads/gh-pages
28+
rm -rf *
29+
mv ../book/* .
30+
git add .
31+
git commit -m "Deploy $GITHUB_SHA to gh-pages"
32+
git push --force --set-upstream origin gh-pages

0 commit comments

Comments
 (0)