-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-deploy.yml
More file actions
72 lines (57 loc) · 1.86 KB
/
azure-deploy.yml
File metadata and controls
72 lines (57 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Deploy to Azure Web App
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, iconv, json, mbstring, pdo
coverage: none
- name: Copy .env
run: cp .env.example .env
- name: Install Composer dependencies
run: composer install --no-dev --optimize-autoloader --no-interaction
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install NPM dependencies
run: npm ci
- name: Build assets
run: npm run build
- name: Generate APP_KEY
run: php artisan key:generate --force
- name: Set directory permissions
run: chmod -R 755 storage bootstrap/cache
- name: Clear caches
run: |
php artisan config:clear
php artisan route:clear
php artisan view:clear
php artisan cache:clear
- name: Optimize for production
run: |
php artisan config:cache
php artisan route:cache
php artisan view:cache
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v3
with:
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
slot-name: 'production'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: .
- name: Run migrations on Azure
run: |
curl -X POST "https://${{ secrets.AZURE_WEBAPP_NAME }}.azurewebsites.net/api/migrate" \
-H "Content-Type: application/json" \
-d '{"token": "${{ secrets.MIGRATION_TOKEN }}"}'