Skip to content

Commit 0066c52

Browse files
committed
add github CI action
1 parent d654e0c commit 0066c52

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/mdbook.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy mdBook site via ssh
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
11+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
12+
concurrency:
13+
group: "pages"
14+
cancel-in-progress: false
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
env:
20+
MDBOOK_VERSION: 0.4.51
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Install mdBook
24+
run: |
25+
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
26+
rustup update
27+
cargo install --version ${MDBOOK_VERSION} mdbook
28+
- name: Build with mdBook
29+
run: mdbook build
30+
- name: Upload artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: book
34+
path: book/
35+
36+
# Deployment job
37+
# https://zellwk.com/blog/github-actions-deploy/
38+
deploy:
39+
runs-on: ubuntu-latest
40+
needs: build
41+
steps:
42+
- name: Download artifact
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: book
46+
path: book/
47+
- name: Install SSH Key
48+
uses: shimataro/ssh-key-action@v2
49+
with:
50+
key: ${{ secrets.DEPLOY_SSH_KEY }}
51+
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
52+
- name: Adding Known Hosts
53+
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOSTNAME }} >> ~/.ssh/known_hosts
54+
- name: Deploy with rsync
55+
run: rsync -avh --delete ./book/ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOSTNAME }}:/var/www/docs.alias-asso.fr/
56+
57+

0 commit comments

Comments
 (0)