Skip to content

Commit 60d253f

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent dae602f commit 60d253f

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/main_apsphp.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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 - apsphp
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: '8.1'
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: Upload artifact for deployment job
35+
uses: actions/upload-artifact@v2
36+
with:
37+
name: php-app
38+
path: .
39+
40+
deploy:
41+
runs-on: ubuntu-latest
42+
needs: build
43+
environment:
44+
name: 'Production'
45+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
46+
47+
steps:
48+
- name: Download artifact from build job
49+
uses: actions/download-artifact@v2
50+
with:
51+
name: php-app
52+
53+
- name: 'Deploy to Azure Web App'
54+
uses: azure/webapps-deploy@v2
55+
id: deploy-to-webapp
56+
with:
57+
app-name: 'apsphp'
58+
slot-name: 'Production'
59+
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_C44BAB7A2FF54287B3953AF6F5FCB4E2 }}
60+
package: .

0 commit comments

Comments
 (0)