Skip to content

build: connection changes #19

build: connection changes

build: connection changes #19

name: EC2 Command Execution
on: [push]
jobs:
execute-command:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js 18
uses: actions/setup-node@v2
with:
node-version: 18
- name: Execute commands on EC2
env:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H "$HOST" >> ~/.ssh/known_hosts
ssh -o StrictHostKeyChecking=no $USERNAME@$HOST << EOF
source ~/.nvm/nvm.sh
node -v
cd ~/frappe-bench/apps/erpnext
git pull
cd ~/frappe-bench
sudo kill -9 \$(sudo lsof -t -i:8000)
sudo kill -9 \$(sudo lsof -t -i:11000)
sudo kill -9 \$(sudo lsof -t -i:13000)
screen
bench start
EOF