Make correction #28
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: 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 |