Skip to content

ec2 deployment action #1

ec2 deployment action

ec2 deployment action #1

Workflow file for this run

name: Deploy Project to EC2
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.EC2_HOST }} >> ~/.ssh/known_hosts
- name: Connect to EC2 and deploy
run: |
ssh -i ~/.ssh/id_rsa ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "\
cd /Full-Stack-Project-Assessment && \
git checkout main && \
git pull && \
npm run build"