-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoetry.yaml
136 lines (110 loc) · 3.78 KB
/
poetry.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Build and deploy Python app to Azure Web App - Azure-Django-Web
on:
push:
branches:
- Blog
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python version
# uses: actions/setup-python@v1
uses: actions/setup-python@v1
with:
python-version: '3.12'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install
- name: Debug Poetry environment
run: |
which poetry
poetry --version
poetry show
- name: Collect static files
run: |
cd firstproject
poetry run python ./manage.py collectstatic --noinput
- name: Zip artifact for deployment
run: |
zip release.zip ./* -r
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v3
with:
name: python-app
path: |
release.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
# url: 'https://azure-django-web.azurewebsites.net/'
permissions:
id-token: write
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: python-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_E92FF502FD2F4E9580C1F664FA41F3D6 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_CBD94531A7504A8BBDF61959546303C8 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_696086DF1A5D40A6BB8587671314F5FE }}
# creds: ${{ secrets.AZURE_CREDENTIALS }}
# - name: Configure VNet Integration
# run: |
# az webapp vnet-integration add --name 'azure-django-web' --resource-group 'deploy' --vnet 'myVNet' --subnet 'default'
- name: Set environment variables on Azure Web App
run: |
az webapp config appsettings set --name 'Azure-Django-Web' --resource-group 'deploy' --settings \
DB_NAME=${{ secrets.DB_NAME }} \
DB_USER=${{ secrets.DB_USER }} \
DB_PASS=${{ secrets.DB_PASS }} \
DB_HOST=${{ secrets.DB_HOST }} \
SECRET_KEY='${{ secrets.SECRET_KEY }}' \
PORT=8000 \
WEBSITE_PORT=8000 \
WEBSITES_PORT=8000 \
WEBSITE_RUN_FROM_PACKAGE=1
- name: Set up Python version
# uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
# - name: Ensure Poetry is in PATH
# run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry install
poetry show
ls
- name: Debug Poetry environment
run: |
which poetry
poetry --version
python --version
# - name: Start Gunicorn
# run: |
# cd firstproject
# ls
# poetry run gunicorn --bind 0.0.0.0:8000 --timeout 600 firstproject.wsgi:application
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: 'Azure-Django-Web'
slot-name: 'Production'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}