From e4c9bdf37a0631eb4357eb019e4af603eed5d7ff Mon Sep 17 00:00:00 2001 From: BlessOnyi Date: Wed, 12 Feb 2025 21:03:16 +0100 Subject: [PATCH] committing deployment.yml --- .github/workflows/deployment.yml | 34 ++++++++++++++------------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index b0134c82c..fe2461171 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -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 \ No newline at end of file + 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 \ No newline at end of file