Skip to content

Commit

Permalink
docs:CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
rocknroll17 committed Nov 2, 2024
1 parent c062fba commit d0ce269
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
name: Backend Deploy
name: Deploy to EC2

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build_and_push:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

- name: Deploy
env:
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }}
EC2_USER: 'ubuntu'
EC2_HOST: 'ec2-3-38-23-48.ap-northeast-2.compute.amazonaws.com'
- name: Set up SSH
run: |
echo "$SSH_PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
ssh -i private_key.pem -o StrictHostKeyChecking=no $EC2_USER@$EC2_HOST 'bash /home/ubuntu/deploy.sh'
rm private_key.pem # SSH 키 파일 삭제
echo "${{ secrets.EC2_SSH_KEY }}" > private_key
chmod 600 private_key
- name: Deploy to EC2
run: |
ssh -i private_key -o StrictHostKeyChecking=no [email protected] 'bash ~/deploy.sh'

0 comments on commit d0ce269

Please sign in to comment.