-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (27 loc) · 1.17 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: Deploy Twitter Bot
on:
push:
branches:
- main # Trigger workflow on push to main branch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3 # Fetch the latest code
- name: Deploy to Oracle VM
uses: appleboy/[email protected]
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USER }}
key: ${{ secrets.ORACLE_SSH_KEY }}
passphrase: ${{ secrets.ORACLE_SSH_PASSPHRASE }} # Optional, if your key has a passphrase
script: |
cd /home/ubuntu/xtwitter_bot # Navigate to the bot directory
git pull origin main # Pull the latest code from the repo
pip3 install --upgrade pip # Ensure pip is up to date
pip3 install -r requirements.txt # Install dependencies from requirements.txt
pkill -f xtwitter_bot.py || true # Stop the bot if it's already running
sleep 2 # Give it some time to clean up
screen -dmS xtwitter_bot python3 xtwitter_bot.py > bot.log 2>&1 # Start the bot in a screen session and log output
screen -ls # Verify that the screen session started