π¨ λλ€μ μΆκ°!!!!!!!!!!!!!!!!!!!!!!!! #121
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy To EC2 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
Deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSHλ‘ EC2μ μ μνκΈ° | |
uses: appleboy/[email protected] | |
env: | |
ENV: ${{ secrets.ENV }} | |
with: | |
host: ${{ secrets.EC2_HOST }} # EC2μ μ£Όμ | |
username: ${{ secrets.EC2_USERNAME }} # EC2 μ μ username | |
key: ${{ secrets.EC2_PRIVATE_KEY }} # EC2μ Key νμΌμ λ΄λΆ ν μ€νΈ | |
envs: ENV | |
script_stop: true # μλ script μ€ μ€ν¨νλ λͺ λ Ήμ΄ νλλΌλ μμΌλ©΄ μ€ν¨λ‘ μ²λ¦¬ | |
script: | | |
cd /home/ubuntu/Skhuthon_0th_TEAM03_BE | |
rm -rf .env | |
git fetch origin | |
git reset --hard origin/main | |
echo "$ENV" > .env | |
npm install | |
npm run build | |
pm2 kill | |
pm2 start dist/main.js --name "backend-server" |