Skip to content

Merge pull request #13 from wang-bam-bbang/comment #10

Merge pull request #13 from wang-bam-bbang/comment

Merge pull request #13 from wang-bam-bbang/comment #10

Workflow file for this run

name: Deploy Find-it Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Add SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.AWS_EC2_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.AWS_EC2_HOST }} >> ~/.ssh/known_hosts
- name: Deploy to EC2
run: |
ssh -i ~/.ssh/id_rsa ec2-user@${{ secrets.AWS_EC2_HOST }} << 'EOF'
cd ~/find-it-be
git pull origin main
npm install
npx prisma generate
npx prisma migrate deploy
npm run build
pm2 restart all
EOF