refactor: Shift from rsync to git pull. #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ---" |