Skip to content

feat: Set up GitHub Actions for Azure Web App deployment and create b… #3

feat: Set up GitHub Actions for Azure Web App deployment and create b…

feat: Set up GitHub Actions for Azure Web App deployment and create b… #3

Workflow file for this run

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions
name: Build and deploy Python app to Azure Web App - gymbro
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Python version
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
working-directory: ./backend
run: |
python -m venv antenv
source antenv/bin/activate
pip install -r requirements.txt
- name: Prepare deployment package
run: |
mkdir deploy
cp -r backend/* deploy/
rm -rf deploy/antenv deploy/.venv deploy/.env deploy/__pycache__ deploy/.pytest_cache
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v4
with:
name: python-app
path: deploy/
deploy:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write
contents: read
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_106F58A50E4D4D369496B1C5E7D299C3 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_5EAE941BA6DB44AFAD213E04CE1478F1 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_6637D6E616BE43A890CFDC7B4156DC1D }}
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v3
id: deploy-to-webapp
with:
app-name: 'gymbro'
slot-name: 'Production'