-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (66 loc) · 1.99 KB
/
deploy.yml
File metadata and controls
81 lines (66 loc) · 1.99 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
77
78
79
80
81
name: Deploy to Production
on:
release:
types: [published]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy via SFTP
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: mbstring, xml, ctype, json
- name: Install production dependencies
run: composer install --no-dev --optimize-autoloader --no-interaction
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install npm dependencies
run: npm ci
- name: Build assets
run: npm run build
- name: Prepare production files
run: |
# Remove dev/test files
rm -rf tests
rm -rf node_modules
rm -f phpunit.xml
rm -f .editorconfig
rm -f vite.config.js
rm -f package.json
rm -f package-lock.json
rm -f .phpunit.result.cache
# Remove git files
rm -rf .git
rm -rf .github
rm -f .gitignore
rm -f .gitattributes
# Remove documentation
rm -f README.md
rm -f CHANGELOG.md
# Remove composer files (vendor already installed)
rm -f composer.json
rm -f composer.lock
# Remove source assets (compiled assets are in public/build)
rm -rf resources/css
rm -rf resources/js
# Remove other unnecessary files
rm -f .env.example
rm -f deploy.sh
- name: Deploy via SFTP
uses: wlixcc/SFTP-Deploy-Action@v1.2.4
with:
server: ${{ secrets.SFTP_HOST }}
username: ${{ secrets.SFTP_USERNAME }}
password: ${{ secrets.SFTP_PASSWORD }}
local_path: "./*"
remote_path: ${{ secrets.SFTP_PATH }}
sftp_only: true
delete_remote_files: false