Skip to content

Commit

Permalink
Merge pull request #55 from Pironeer-APP/cdChan
Browse files Browse the repository at this point in the history
[cd] 자동 배포 초안및 테스트 최종2
  • Loading branch information
chan000518 authored Aug 12, 2024
2 parents 45a69fa + 4ffef59 commit b674d52
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/fastcd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,16 @@ jobs:
- name: Install dependencies
run: npm install

# GitHub Secrets에서 SSH 키를 파일로 저장하고, 올바른 권한을 설정합니다.
- name: Add SSH key
run: |
echo "$DEPLOY_KEY" > /tmp/deploy_key.pem
chmod 600 /tmp/deploy_key.pem
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}

# AWS EC2 인스턴스에 접속하여 애플리케이션을 배포합니다.
- name: Deploy to AWS EC2
run: |
ssh -i /tmp/deploy_key.pem -o StrictHostKeyChecking=no [email protected]
cd Pironeer_Attend_Web/
pm2 stop app.js || true
git pull origin main
npm install --production
pm2 start app.js
EOF
# 배포 후, SSH 키 파일을 명시적으로 삭제합니다.
- name: Clean up
run: rm /tmp/deploy_key.pem
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd Pironeer_Attend_Web/
pm2 stop app.js || true
git pull origin main
npm install --production
pm2 start app.js

0 comments on commit b674d52

Please sign in to comment.