-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (42 loc) · 1.26 KB
/
deploy.yml
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
name: Deploy to Production
on:
workflow_dispatch:
push:
branches:
- trunk
paths:
- 'app/src/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
- name: Add host key
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
run: |
mkdir -p ~/.ssh
ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts
- name: Install Composer
uses: php-actions/composer@v6
with:
php_version: '8.3'
version: '2.8.4'
- name: Install composer dependencies
run: |
cd app
composer install --no-dev
cd ..
- name: Deploy to production
env:
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
run: |
rsync -avz --delete app/src/ "$DEPLOY_USER@$DEPLOY_HOST:/var/www/html/src"
rsync -avz --delete app/vendor/ "$DEPLOY_USER@$DEPLOY_HOST:/var/www/html/vendor"
rsync -avz app/index.php "$DEPLOY_USER@$DEPLOY_HOST:/var/www/html/index.php"