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 - php-without-composer
5+
6+ on :
7+ push :
8+ branches :
9+ - master
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.1'
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+ permissions :
49+ id-token : write # This is required for requesting the JWT
50+ contents : read # This is required for actions/checkout
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_1ED1C8A142054F51808E071537DD616B }}
65+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_3A978166E30A49EE9CD0E946B996FF6C }}
66+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_92BA1D59CA0D4EF8AF577857CD8BEEDF }}
67+
68+ - name : ' Deploy to Azure Web App'
69+ uses : azure/webapps-deploy@v3
70+ id : deploy-to-webapp
71+ with :
72+ app-name : ' php-without-composer'
73+ slot-name : ' Production'
74+ package : .
75+
0 commit comments