From 381a90fdc965d56d889ad5a5d3116389e795c8a0 Mon Sep 17 00:00:00 2001 From: Yoo TaeSeung Date: Tue, 10 Sep 2024 14:38:50 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B0=B0=ED=8F=AC=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ec2Deploy.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/ec2Deploy.yaml diff --git a/.github/workflows/ec2Deploy.yaml b/.github/workflows/ec2Deploy.yaml new file mode 100644 index 00000000..0f0e6a78 --- /dev/null +++ b/.github/workflows/ec2Deploy.yaml @@ -0,0 +1,27 @@ +name: Deploy to EC2 + +on: + push: + branches: + - deploy/#271/automated-deploy + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install SSH key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.EC2_PEM_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + + - name: Add EC2 to known hosts + run: ssh-keyscan -H ec2-43-200-222-157.ap-northeast-2.compute.amazonaws.com >> ~/.ssh/known_hosts + + - name: SSH into EC2 and execute deployment script + run: | + ssh -i ~/.ssh/id_rsa ubuntu@ec2-43-200-222-157.ap-northeast-2.compute.amazonaws.com "cd PICKPLE-client && sh deploy.sh"