build: removed screeen #21
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: 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) | |
bench start | |
exit | |
EOF |