From 0b7c1c18d2103b0f07038d26a0048990da69c82d Mon Sep 17 00:00:00 2001 From: BlessOnyi Date: Wed, 12 Feb 2025 20:51:53 +0100 Subject: [PATCH] test: deployment test --- .github/workflows/deployment.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/deployment.yml diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 000000000..b0134c82c --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,32 @@ +name: Deployment of FastAPI Book Project + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - 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 + 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