-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (55 loc) · 1.93 KB
/
build-and-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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Build and deploy
on:
push:
branches:
- "main"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2
- name: Inject access token in .npmrc
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ./frontend/app/.npmrc
- name: Execute buildscript.
run: cd ./frontend/app/ && php ./build.php --cleanup
- name: Run tests
run: |
cd ./frontend/app && /vendor/bin/phpunit --testdox tests
- name: rsync deploy files and set www-data user.
uses: burnett01/rsync-deployments@4.1
with:
switches: -avzrog --backup --backup-dir=${{ secrets.BACKUP_PATH }}/$GITHUB_SHA --chown=www-data:www-data
path: .
remote_path: ${{ secrets.DEPLOY_PATH }}
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
remote_port: ${{ secrets.DEPLOY_PORT }}
- name: Set file permissions.
uses: appleboy/ssh-action@master
with:
script: find ${{ secrets.DEPLOY_PATH }} -path ! -type l -exec chmod g+rw {} +
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
- name: Clear all cache.
uses: appleboy/ssh-action@v0.1.4
with:
script: |
cd ${{ secrets.DEPLOY_PATH }}
rm -rf ${{ secrets.DEPLOY_PATH }}/../.cache/vhosts/Jelastic/* || true
rm /tmp/blade-engine-cache/* || true
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}