add algolia script #1
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 # or your default branch name | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install SSH key | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | |
- name: Deploy to EC2 | |
env: | |
HOST: ec2-13-60-240-164.eu-north-1.compute.amazonaws.com | |
USER: ubuntu | |
run: | | |
ssh -o StrictHostKeyChecking=no $USER@$HOST << EOF | |
export PATH="/home/ubuntu/.nvm/versions/node/v20.17.0/bin:/home/ubuntu/.yarn/bin:$PATH" | |
cd dapfy-market-be | |
git fetch origin | |
git reset --hard origin/main | |
/home/ubuntu/.nvm/versions/node/v20.17.0/bin/yarn prisma db push | |
/home/ubuntu/.nvm/versions/node/v20.17.0/bin/yarn install | |
/home/ubuntu/.nvm/versions/node/v20.17.0/bin/yarn build:prod | |
/home/ubuntu/.yarn/bin/pm2 restart be-api | |
EOF |