Skip to content

test

test #2

Workflow file for this run

name: Deploy to EC2
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
- name: Add EC2 host to known_hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -H ${{ secrets.EC2_PUBLIC_IP }} >> ~/.ssh/known_hosts
- name: Deploy to EC2 using rsync
run: |
rsync -avz -e "ssh -i /home/runner/.ssh/deploy_key" ./ [email protected]:/home/ec2-user/let_me_know
env:
EC2_USER: ec2-user
EC2_HOST: ${{ secrets.EC2_PUBLIC_IP }}
REMOTE_PATH: /home/ec2-user/let_me_know