|
| 1 | +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy |
| 2 | +# More GitHub Actions for Azure: https://github.com/Azure/actions |
| 3 | +# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions |
| 4 | + |
| 5 | +name: Build and deploy Python app to Azure Web App - llmchatappmano |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Set up Python version |
| 21 | + uses: actions/setup-python@v1 |
| 22 | + with: |
| 23 | + python-version: '3.10' |
| 24 | + |
| 25 | + - name: Create and start virtual environment |
| 26 | + run: | |
| 27 | + python -m venv venv |
| 28 | + source venv/bin/activate |
| 29 | +
|
| 30 | + - name: Install dependencies |
| 31 | + run: pip install -r requirements.txt |
| 32 | + |
| 33 | + # Optional: Add step to run tests here (PyTest, Django test suites, etc.) |
| 34 | + - name: Zip artifact for deployment |
| 35 | + run: zip release.zip ./* -r |
| 36 | + |
| 37 | + - name: Upload artifact for deployment jobs |
| 38 | + uses: actions/upload-artifact@v3 |
| 39 | + with: |
| 40 | + name: python-app |
| 41 | + path: | |
| 42 | + release.zip |
| 43 | + !venv/ |
| 44 | +
|
| 45 | + deploy: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + needs: build |
| 48 | + environment: |
| 49 | + name: 'Production' |
| 50 | + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: Download artifact from build job |
| 54 | + uses: actions/download-artifact@v3 |
| 55 | + with: |
| 56 | + name: python-app |
| 57 | + |
| 58 | + - name: Unzip artifact for deployment |
| 59 | + run: unzip release.zip |
| 60 | + |
| 61 | + - name: 'Deploy to Azure Web App' |
| 62 | + uses: azure/webapps-deploy@v2 |
| 63 | + id: deploy-to-webapp |
| 64 | + with: |
| 65 | + app-name: 'llmchatappmano' |
| 66 | + slot-name: 'Production' |
| 67 | + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_F788934FDD0449F196A2B58892235B5E }} |
0 commit comments