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