Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
name: Deployment of FastAPI Book Project

name: Deploy FastAPI Book Project
on:
push:
branches:
- main

- main
jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python Env
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Set up SSH agent
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Deploy to Azure VM
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/blessing-azure.pem
chmod 600 ~/.ssh/blessing-azure.pem
- name: Deploy to Azure
run: |
ssh -o StrictHostKeyChecking=no blessing@${{ secrets.SEVER_IP }}
cd /home/blessing/fastapi-book-project
git pull origin main
source venv/bin/activate
pip install -r requirements.txt
sudo systemctl restart fastapi
ssh -o StrictHostKeyChecking=no -i ~/.ssh/blessing-azure.pem blessing@${{ secrets.SERVER_IP }} << 'EOF'
cd /home/blessing/fastapi-book-project
git pull origin main
source venv/bin/activate
pip install -r requirements.txt
sudo systemctl restart fastapi