Skip to content

Commit 2aa59e4

Browse files
committed
2 parents 60ab413 + 76bf714 commit 2aa59e4

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/main_laragram.yml

Lines changed: 75 additions & 0 deletions
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 - laragram
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@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@v3
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@v3
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@v1
63+
with:
64+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_01D673E910694C0486108BEC31D026F3 }}
65+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_BE7BD1CA69594EADBD8A0B11D5300451 }}
66+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_23F1BF4FD78448C4AA93FF05307A5734 }}
67+
68+
- name: 'Deploy to Azure Web App'
69+
uses: azure/webapps-deploy@v2
70+
id: deploy-to-webapp
71+
with:
72+
app-name: 'laragram'
73+
slot-name: 'Production'
74+
package: .
75+

0 commit comments

Comments
 (0)