fixed deploy script #13
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 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Deploy to Oracle VM | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.ORACLE_HOST }} | |
username: ${{ secrets.ORACLE_USER }} | |
key: ${{ secrets.ORACLE_SSH_KEY }} | |
script: | | |
echo "Setting up SSH config:" | |
echo -e "Host github.com\n\tHostName github.com\n\tIdentityFile /home/ubuntu/.ssh/temp_ssh/id_ed25519\n\tIdentitiesOnly yes" > /home/ubuntu/.ssh/config | |
chmod 600 /home/ubuntu/.ssh/config | |
echo "Pulling latest code:" | |
cd /home/ubuntu/xtwitter_bot | |
git pull origin main || echo "Git pull failed" | |
echo "Activating virtual environment:" | |
source venv/bin/activate | |
echo "Restarting bot:" | |
screen -ls | grep "phil_bot" && screen -S phil_bot -X quit || true | |
screen -dmS phil_bot venv/bin/python3 xtwitter_bot.py > bot.log 2>&1 | |
echo "Active screen sessions:" | |
screen -ls | |