Add .env to .gitignore #2
This file contains 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 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 |