Update README.md #9
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: Python (Flask) application to Azure | |
env: | |
AZURE_WEBAPP_NAME: kpi5Graphics | |
RESOURCE_GROUP: Womenplusplus | |
PYTHON_VERSION: '3.10' | |
APP_LOCATION: 'src/FlaskGraphics' | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install -r ${{ env.APP_LOCATION }}/requirements.txt | |
- name: Set up dependency caching for faster installs | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('${{ env.APP_LOCATION }}/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Upload artifact for deployment jobs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-app | |
path: ${{ env.APP_LOCATION }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: 'Production' | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-app | |
- name: Log in to Azure CLI using service principal | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS_GRAPHS }} | |
- name: Deploy to Azure WebApp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
slot-name: 'Production' | |
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE_GRAPHS }} |