Skip to content

Commit

Permalink
chore: update deploy-to-aws-ec2.yml (#22)
Browse files Browse the repository at this point in the history
chore: update deploy-to-aws-ec2.yml
  • Loading branch information
cjeongmin authored Aug 16, 2024
1 parent 3f8ffce commit 7932f2a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/deploy-to-aws-ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ jobs:
- name: Build the project
run: npm run build

- name: Deploy to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
port: 22
script: |
- name: Create SSH key file
run: |
echo "${{ secrets.EC2_KEY }}" > ec2_key.pem
chmod 600 ec2_key.pem
- name: Deploy to EC2 via SSH
run: |
ssh -i ec2_key.pem -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
cd ~/front-end
git pull origin main
npm install
npm run build
pm2 start npm --name "${{ secrets.APP_NAME }}" -- start || pm2 restart "${{ secrets.APP_NAME }}"
EOF

0 comments on commit 7932f2a

Please sign in to comment.