Update main.yml #4
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: CI/CD for NestJS Project | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# دریافت کد از مخزن | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# فعال کردن SSH-Agent و تنظیم کلید خصوصی | |
- name: Setup SSH and Deploy | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
run: | | |
eval "$(ssh-agent -s)" | |
echo "$SSH_PRIVATE_KEY" | ssh-add - | |
ssh-keyscan -H 65.109.187.30 >> ~/.ssh/known_hosts | |
ssh [email protected] << 'EOF' | |
cd /home/project/test-nest-snapp/SnappFood-Nestjs | |
git pull | |
npm install | |
npm run build | |
npm run start:dev | |
EOF |