Skip to content

DeployStanfordTest

DeployStanfordTest #4

Workflow file for this run

name: DeployStanfordTest
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to run the workflow on'
required: true
default: 'QA'
push:
branches:
- QA
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.MY_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
echo "${{ secrets.MY_SSH_KEY }}" | base64 --decode > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Sync repository to server
run: |
rsync -e "ssh -i ~/.ssh/id_rsa -o ConnectTimeout=600 -o ServerAliveInterval=30 -o ServerAliveCountMax=5" \
-av --delete . \
[email protected]:/home/rcpediaq/rcpedia-dev.stanford.edu/
- name: Install dependencies & Build MkDocs on server
run: |
ssh -t -i ~/.ssh/id_rsa -o ConnectTimeout=600 -o ServerAliveInterval=30 -o ServerAliveCountMax=5 \
[email protected] << 'EOF'
cd /home/rcpediaq/rcpedia-dev.stanford.edu
# Ensure pip is installed and updated
python3 -m ensurepip --default-pip
python3 -m pip install --upgrade pip
# Install dependencies into the user directory to avoid permission errors.
# IMPORTANT: If Babel==2.15.0 is not compatible with Python 3.6 on your server,
# either update Python (to 3.7+) or change the Babel version in requirements.txt.
python3 -m pip install --user -r requirements.txt
# Add the user's local bin directory to PATH if mkdocs was installed there.
export PATH=$HOME/.local/bin:$PATH
# Run MkDocs build
mkdocs build --clean
EOF
# Uncomment the following block if you want to run link checking after deployment.
# check_links:
# needs: deploy
# runs-on: ubuntu-latest
# steps:
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.12.3'
# - name: Install linkchecker
# run: pip install linkchecker
# - name: Run linkchecker
# run: linkchecker --no-robots --check-extern -r 10 https://rcpedia-dev.stanford.edu