Skip to content

GitHub Action pushing new questions #169

GitHub Action pushing new questions

GitHub Action pushing new questions #169

Workflow file for this run

name: deploy
# Only run this when the main branch changes
on:
pull_request:
merge_group:
workflow_dispatch:
push:
branches:
- main
concurrency:
group: deploy_jb
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install dependencies
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: cache installation
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install jupyter-book
- name: execute scripts
run: |
python scripts/create_toc.py
python scripts/visualize_questions.py
- name: Build the book
run: |
jupyter-book build .
# - name: Commit updated TOC
# uses: EndBug/add-and-commit@latest
# with:
# message: 'Update TOC via GH Action'
# Push to server
- name: rsync and ssh
env:
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
REMOTE_KEY: ${{ secrets.SERVER_SSH_KEY }}
REMOTE_DIR: ${{ secrets.REMOTE_TARGET }}
LOCAL_DIR: "_build/html/"
COURSE_NAME: "stats_bank"
run: |
mkdir ~/.ssh
echo "$REMOTE_KEY" > ~/.ssh/id_rsa
ssh-keyscan -H $REMOTE_HOST >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/id_rsa
pwd
ls -la
rsync -avzr --delete $LOCAL_DIR $REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$COURSE_NAME