Skip to content

Make correction

Make correction #28

name: EC2Workflow
on:
push:
branches:
- Feature-deploy-in-AWS
paths:
- "server/**"
defaults:
run:
working-directory: "server"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create private key
run: echo "${{ secrets.SSH_PRIVATE_KEY}}" > terraform-week-pem-file.pem
- name: Connect to EC2
run: |
chmod 400 terraform-week-pem-file.pem
echo "${{ vars.SSH_USERNAME }}@${{ vars.EC2_HOST }}"
cat terraform-week-pem-file.pem
ssh -i terraform-week-pem-file.pem -o StrictHostKeyChecking=no "${{ vars.SSH_USERNAME }}@${{ vars.EC2_HOST }}" << EOF
cd terraform-VideoStorage-app
git pull
cd server
npm install
NODE_ENV=aws pm2 restart server.js
EOF