51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
name: Deploy to Production on Master Push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
# Rebuild the assistant search index from the CURRENT content so it is
|
|
# always in sync — no manual step needed when pages change.
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: Rebuild assistant search index
|
|
run: |
|
|
python -m pip install --quiet beautifulsoup4
|
|
python tools/build_search_index.py
|
|
|
|
- name: Deploy to Server via rsync
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y -qq rsync openssh-client
|
|
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
|
|
rsync -avz --delete \
|
|
--exclude=".git/" \
|
|
--exclude=".gitea/" \
|
|
--exclude=".gitignore" \
|
|
--exclude="README.md" \
|
|
--exclude="*.sh" \
|
|
--exclude="*.py" \
|
|
--exclude="code_export.txt" \
|
|
--exclude="docs/" \
|
|
--exclude="templates/" \
|
|
--exclude="tools/" \
|
|
-e "ssh -p ${{ secrets.SSH_PORT }} -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no" \
|
|
./ \
|
|
${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.TARGET_MASTER_DIR }}
|