Del:key files #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: Deploy FastAPI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Deploy to EC2 | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF' | |
cd planner_server | |
git pull origin main | |
${{ secrets.USER_NAME }} | |
${{ secrets.PULL_KEY }} | |
cd Controller | |
source myenv/bin/activate | |
pip install -r requirements.txt | |
pkill -f uvicorn | |
nohup uvicorn main:app --host 0.0.0.0 --port 1500 > uvicorn.log 2>&1 & | |
EOF |