-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (50 loc) · 1.81 KB
/
deploy.yml
File metadata and controls
52 lines (50 loc) · 1.81 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
name: Deploy to specific server
on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'tests/**'
- '**.md'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- uses: php-actions/composer@v6
- name: Enter maintenance mode
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
. ${{ secrets.BASH_ENV_FILE }}
test -f ${{ secrets.DEPLOY_PATH }}/artisan && ${{ secrets.DEPLOY_PATH }}/artisan down || true
- name: Copy files to the server
uses: burnett01/rsync-deployments@5.2
with:
switches: -avzr --delete --delete-excluded --include-from=.github/workflows/rsync.include --exclude-from=.github/workflows/rsync.exclude
remote_path: ${{ secrets.DEPLOY_PATH }}
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
- name: Clear cache and run migrations
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
. ${{ secrets.BASH_ENV_FILE }}
${{ secrets.DEPLOY_PATH }}/artisan migrate --force
${{ secrets.DEPLOY_PATH }}/artisan cache:clear
${{ secrets.DEPLOY_PATH }}/artisan up