-
Notifications
You must be signed in to change notification settings - Fork 16
94 lines (80 loc) · 2.82 KB
/
deploy.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: deploy-book
# Only run this when the master branch changes
on:
workflow_dispatch:
push:
branches:
- main
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install dependencies
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: cache installation
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}
- id: install-graphviz-linux
name: Install Graphviz on Linux
# if: runner.os == 'Linux'
# shell: bash
run: |
# Install Graphviz on Linux
sudo apt update
sudo apt install -qy gsfonts
sudo apt -qq list fonts-liberation gsfonts
sudo apt install -qy graphviz
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo apt clean
- name: Install dependencies
run: |
pip install -r requirements.txt
# Set the kernel to remove the conda kernel
- name: Remove Special Kernel
run: |
python -m ipykernel install --user --name conda-env-cpsc330-24-py
python -m ipykernel install --user --name conda-env-cpsc330-py
# jupytext --set-kernel conda-env-cpsc330-24-py --to md:myst
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
# Push to CS server
- name: rsync and ssh to CS
env:
COURSE_REMOTE_HOST: kunghit.students.cs.ubc.ca
COURSE_REMOTE_USER: cs-330
CS_REMOTE_USER: firasm
CS_TUNNEL: remote.cs.ubc.ca
REMOTE_KEY: ${{ secrets.FIRAS_SERVER_SSH_KEY }}
FIRAS_KEYBOARDMBP: ${{ secrets.FIRAS_KEYBOARDMBP }}
TERM: 2024_W1
LOCAL_DIR: _build/html/
run: |
mkdir -p ~/.ssh
echo "$REMOTE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H $CS_TUNNEL >> ~/.ssh/known_hosts
echo "$FIRAS_KEYBOARDMBP" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
# Set up a tunnel in the background
ssh -fN -L 2222:$COURSE_REMOTE_HOST:22 $CS_REMOTE_USER@$CS_TUNNEL -p 22
# send files all in one shot
rsync -avzr -e 'ssh -p 22 -o StrictHostKeyChecking=no -J $CS_REMOTE_USER@$CS_TUNNEL' $LOCAL_DIR $COURSE_REMOTE_USER@$COURSE_REMOTE_HOST:public_html/$TERM
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3