Skip to content

refactor: Shift from rsync to git pull. #5

refactor: Shift from rsync to git pull.

refactor: Shift from rsync to git pull. #5

Workflow file for this run

name: Deploy Discord Bot to VM
# This workflow runs on two conditions:
# 1. A push event to the 'main' branch.
# 2. A 'workflow_dispatch' event, which adds a "Run workflow" button on the Actions tab.
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
# Tell GitHub to send this job to any available runner with the 'self-hosted' label.
runs-on: self-hosted
steps:
# Run the deployment commands directly on the VM's shell.
- name: Deploy Bot
run: |
echo "--- Starting deployment on self-hosted runner ---"
# Run the commands from within the actual project directory.
echo "--- Navigating to project directory ---"
cd /home/makerspace/DiscProdSheetify
echo "--- Pulling latest code from main branch ---"
git pull origin main
echo "--- Syncing Python dependencies ---"
/home/makerspace/.local/bin/uv sync
echo "--- Restarting bot service ---"
sudo systemctl restart DiscProdSheetify.service
echo "--- Deployment complete ---"