Update env
Browse files
env
CHANGED
@@ -7,6 +7,84 @@
|
|
7 |
# To get a newer version, you will need to update the SHA.
|
8 |
# You can also reference a tag or branch, but the action may change without warning.
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
on:
|
11 |
push:
|
12 |
branches:
|
|
|
7 |
# To get a newer version, you will need to update the SHA.
|
8 |
# You can also reference a tag or branch, but the action may change without warning.
|
9 |
|
10 |
+
name: Build and deploy Python app to Azure Web App
|
11 |
+
|
12 |
+
env:
|
13 |
+
AZURE_WEBAPP_NAME: MY_WEBAPP_NAME # set this to your application's name
|
14 |
+
PYTHON_VERSION: '3.8' # set this to the Python version to use
|
15 |
+
|
16 |
+
on:
|
17 |
+
push:
|
18 |
+
branches:
|
19 |
+
- main
|
20 |
+
|
21 |
+
jobs:
|
22 |
+
build:
|
23 |
+
runs-on: ubuntu-latest
|
24 |
+
|
25 |
+
steps:
|
26 |
+
- uses: actions/checkout@v4
|
27 |
+
|
28 |
+
- name: Set up Python version
|
29 |
+
uses: actions/setup-python@v5
|
30 |
+
with:
|
31 |
+
python-version: ${{ env.PYTHON_VERSION }}
|
32 |
+
|
33 |
+
- name: Create and start virtual environment
|
34 |
+
run: |
|
35 |
+
python -m venv venv
|
36 |
+
source venv/bin/activate
|
37 |
+
|
38 |
+
- name: Set up dependency caching for faster installs
|
39 |
+
uses: actions/cache@v3
|
40 |
+
with:
|
41 |
+
path: ~/.cache/pip
|
42 |
+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
43 |
+
restore-keys: |
|
44 |
+
${{ runner.os }}-pip-
|
45 |
+
|
46 |
+
- name: Install dependencies
|
47 |
+
run: pip install -r requirements.txt
|
48 |
+
|
49 |
+
# Optional: Add a step to run tests here (PyTest, Django test suites, etc.)
|
50 |
+
|
51 |
+
- name: Upload artifact for deployment jobs
|
52 |
+
uses: actions/upload-artifact@v4
|
53 |
+
with:
|
54 |
+
name: python-app
|
55 |
+
path: |
|
56 |
+
.
|
57 |
+
!venv/
|
58 |
+
deploy:
|
59 |
+
runs-on: ubuntu-latest
|
60 |
+
needs: build
|
61 |
+
environment:
|
62 |
+
name: 'production'
|
63 |
+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
|
64 |
+
|
65 |
+
steps:
|
66 |
+
- name: Download artifact from build job
|
67 |
+
uses: actions/download-artifact@v4
|
68 |
+
with:
|
69 |
+
name: python-app
|
70 |
+
path: .
|
71 |
+
|
72 |
+
- name: 'Deploy to Azure Web App'
|
73 |
+
id: deploy-to-webapp
|
74 |
+
uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c
|
75 |
+
with:
|
76 |
+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
|
77 |
+
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
|
78 |
+
|
79 |
+
# This workflow uses actions that are not certified by GitHub.
|
80 |
+
# They are provided by a third-party and are governed by
|
81 |
+
# separate terms of service, privacy policy, and support
|
82 |
+
# documentation.
|
83 |
+
|
84 |
+
# GitHub recommends pinning actions to a commit SHA.
|
85 |
+
# To get a newer version, you will need to update the SHA.
|
86 |
+
# You can also reference a tag or branch, but the action may change without warning.
|
87 |
+
|
88 |
on:
|
89 |
push:
|
90 |
branches:
|