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+
4+ name : Build and deploy PHP app to Azure Web App - itquiz-bmwe
5+
6+ on :
7+ push :
8+ branches :
9+ - main
10+ workflow_dispatch :
11+
12+ jobs :
13+ build :
14+ runs-on : ubuntu-latest
15+ permissions :
16+ contents : read # This is required for actions/checkout
17+
18+ steps :
19+ - uses : actions/checkout@v4
20+
21+ - name : Setup PHP
22+ uses : shivammathur/setup-php@v2
23+ with :
24+ php-version : ' 8.4'
25+
26+ - name : Check if composer.json exists
27+ id : check_files
28+ uses : andstor/file-existence-action@v1
29+ with :
30+ files : ' composer.json'
31+
32+ - name : Run composer install if composer.json exists
33+ if : steps.check_files.outputs.files_exists == 'true'
34+ run : composer validate --no-check-publish && composer install --prefer-dist --no-progress
35+
36+ - name : Zip artifact for deployment
37+ run : zip release.zip ./* -r
38+
39+ - name : Upload artifact for deployment job
40+ uses : actions/upload-artifact@v4
41+ with :
42+ name : php-app
43+ path : release.zip
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+ permissions :
52+ id-token : write # This is required for requesting the JWT
53+ contents : read # This is required for actions/checkout
54+
55+ steps :
56+ - name : Download artifact from build job
57+ uses : actions/download-artifact@v4
58+ with :
59+ name : php-app
60+
61+ - name : Unzip artifact for deployment
62+ run : unzip release.zip
63+
64+ - name : Login to Azure
65+ uses : azure/login@v2
66+ with :
67+ client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_0E9CD8F6A7E4459F9439EDE5B6818D9B }}
68+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_C705A9D3062744E08B3A0CDDC3E5182C }}
69+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_44B13F21BCBC466799AAE33EC12E2E32 }}
70+
71+ - name : ' Deploy to Azure Web App'
72+ uses : azure/webapps-deploy@v3
73+ id : deploy-to-webapp
74+ with :
75+ app-name : ' itquiz-bmwe'
76+ slot-name : ' Production'
77+ package : .
78+
0 commit comments