Skip to content

Update main.yml

Update main.yml #20

Workflow file for this run

name: Execute Remote SSH Commands
on:
push:
branches: [main]
jobs:
execute-commands:
name: Execute Commands
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Debugging - List Contents of Current Directory
run: ls -la
- name: Debugging - Print Working Directory
run: pwd
- name: Execute SSH Commands
uses: appleboy/[email protected]
with:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PASSWORD: ${{ secrets.PASSWORD }}
script: |
# Logging start of script execution
echo "Starting script execution..."
# # Navigate to the directory
# if [ -d "bahja-isaac-nas-discord-chatbot" ]; then
# cd bahja-isaac-nas-discord-chatbot || exit 1
# else
# echo "Error: Directory 'bahja-isaac-nas-discord-chatbot' not found."
# exit 1
# fi
# Pull latest changes from Git
git pull
# Install npm dependencies
npm install
# Stop chatbot if running
pm2 stop chatbot
# Start chatbot
pm2 start index.js --name chatbot
# Logging completion of script execution
echo "Script execution completed successfully."