Fadli Aulawi commited on
Commit
729049b
·
1 Parent(s): 91cda69

Add or update the Azure App Service build and deployment workflow config

Browse files
.github/workflows/main_dossier-translation.yml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 - dossier-translation
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@v5
22
+ with:
23
+ python-version: '3.11'
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
+
35
+ - name: Zip artifact for deployment
36
+ run: zip release.zip ./* -r
37
+
38
+ - name: Upload artifact for deployment jobs
39
+ uses: actions/upload-artifact@v4
40
+ with:
41
+ name: python-app
42
+ path: |
43
+ release.zip
44
+ !venv/
45
+
46
+ deploy:
47
+ runs-on: ubuntu-latest
48
+ needs: build
49
+ environment:
50
+ name: 'Production'
51
+ url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
52
+ permissions:
53
+ id-token: write #This is required for requesting the JWT
54
+
55
+ steps:
56
+ - name: Download artifact from build job
57
+ uses: actions/download-artifact@v4
58
+ with:
59
+ name: python-app
60
+
61
+ - name: Unzip artifact for deployment
62
+ run: unzip release.zip
63
+
64
+
65
+ - name: Login to Azure
66
+ uses: azure/login@v2
67
+ with:
68
+ client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_8066FFA7286C4D0F9E638E8679141B67 }}
69
+ tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_885B6CC71ED64B74B5F9242C6E8E93C8 }}
70
+ subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_53714BDC4023416CA51494645D5F2479 }}
71
+
72
+ - name: 'Deploy to Azure Web App'
73
+ uses: azure/webapps-deploy@v3
74
+ id: deploy-to-webapp
75
+ with:
76
+ app-name: 'dossier-translation'
77
+ slot-name: 'Production'
78
+