Skip to content

Change secrets to vars where relevant #23

Change secrets to vars where relevant

Change secrets to vars where relevant #23

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}}" > videoStorage.pem
- name: Connect to EC2
run: |
chmod 400 videoStorage.pem
echo ""${{ vars.SSH_USERNAME }}@${{ vars.EC2_HOST }}"
cat videoStorage.pem
ssh -i videoStorage.pem -o StrictHostKeyChecking=no "${{ vars.SSH_USERNAME }}@${{ vars.EC2_HOST }}" << EOF
cd video-storage-app
git pull
cd server
npm install
NODE_ENV=aws pm2 restart server.js
EOF