Skip to content

Commit 9a111bb

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent df425ea commit 9a111bb

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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 - my-first-app-123
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.2'
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_1DC88D5D8E9D4B3DA90956980E01CF52 }}
65+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_530EEE314AEC43F6B7300B7D4DDB30CE }}
66+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_3A700215DB5C4946A1EA34E00ACA84C1 }}
67+
68+
- name: 'Deploy to Azure Web App'
69+
uses: azure/webapps-deploy@v3
70+
id: deploy-to-webapp
71+
with:
72+
app-name: 'my-first-app-123'
73+
slot-name: 'Production'
74+
package: .
75+

0 commit comments

Comments
 (0)