-
-
Notifications
You must be signed in to change notification settings - Fork 6
93 lines (84 loc) · 2.82 KB
/
deployment.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
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
82
83
84
85
86
87
88
89
90
91
92
93
name: 🚀 Deployment
# Only trigger, when the build workflow is done
on:
workflow_run:
workflows: [ "🧪 Build test" ]
types:
- completed
jobs:
run:
# Run job only on success of the build test workflow
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
name: Deploy PHP application
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
# extensions: mbstring, pdo, pdo_mysql, intl, zip
coverage: none
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: 📂 Sync files
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.FTP_HOST }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
server-dir: /
exclude: |
.git*/**
docs/**
tests/**
- name: Executing database migrations
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_KEY_PASSPHRASE }}
port: ${{ secrets.SSH_PORT }}
script: |
cd ${{ secrets.DEMO_PROJECT_ROOT }}
chmod +x vendor/bin/phinx
composer migrate
- name: ♥️ Sync files with care-point
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.CARE_POINT_FTP_HOST }}
username: ${{ secrets.CARE_POINT_FTP_USERNAME }}
password: ${{ secrets.CARE_POINT_FTP_PASSWORD }}
server-dir: /
exclude: |
.git*/**
docs/**
tests/**
config/env/env.prod.php
public/assets/favicon.ico
- name: Executing care-point database migrations
uses: appleboy/[email protected]
with:
host: ${{ secrets.CARE_POINT_SSH_HOST }}
username: ${{ secrets.CARE_POINT_SSH_USERNAME }}
key: ${{ secrets.CARE_POINT_SSH_KEY }}
passphrase: ${{ secrets.CARE_POINT_SSH_KEY_PASSPHRASE }}
port: ${{ secrets.CARE_POINT_SSH_PORT }}
script: |
cd ${{ secrets.CARE_POINT_PROJECT_ROOT }}
chmod +x vendor/bin/phinx
composer migrate