-
Notifications
You must be signed in to change notification settings - Fork 9
76 lines (64 loc) · 1.91 KB
/
Copy pathdeploy.yml
File metadata and controls
76 lines (64 loc) · 1.91 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
73
74
75
76
name: Deploy to Production
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, pdo, pdo_pgsql, redis, xml, curl, zip, bcmath
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
- name: Install dependencies
run: |
composer install --prefer-dist --no-dev --optimize-autoloader
npm ci
- name: Build production assets
run: |
npm run build
php artisan config:cache
php artisan route:cache
php artisan view:cache
- name: Run production tests
env:
APP_ENV: production
run: |
php artisan test --testsuite=Feature --stop-on-failure
- name: Create deployment artifact
run: |
tar -czf deploy.tar.gz \
--exclude=node_modules \
--exclude=tests \
--exclude=.git \
--exclude=.github \
--exclude=storage/logs/* \
--exclude=storage/framework/cache/* \
--exclude=storage/framework/sessions/* \
--exclude=storage/framework/views/* \
.
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: deployment-package
path: deploy.tar.gz
retention-days: 5
# Add your deployment steps here
# For example, deploying to a VPS, AWS, DigitalOcean, etc.
# This is a placeholder for your specific deployment strategy
- name: Deploy notification
if: success()
run: |
echo "✅ Deployment package created successfully!"
echo "Version: ${{ github.ref_name }}"
echo "Commit: ${{ github.sha }}"