-
-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (72 loc) · 2.41 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
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
name: Deploy
on:
push:
tags:
- '*'
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: php-${{ matrix.php }}-composer-
- name: Setup MySQL
uses: shogo82148/actions-setup-mysql@v1
with:
distribution: "mariadb"
mysql-version: "10.7"
root-password: "root"
- name: Setup PHP
uses: shivammathur/setup-php@2.9.0
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: xdebug
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-suggest
- name: Execute tests
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: test
DB_USERNAME: root
DB_PASSWORD: root
run: vendor/bin/pest --colors=always
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: 'Production'
needs:
- tests
steps:
- name: Deploy to production server
uses: appleboy/ssh-action@master
with:
command_timeout: 120m
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASS }}
script: |
cd ${{ secrets.PROJECT_PATH}}
php8.2 artisan down
git reset --hard
git fetch origin
git pull "https://Lukasss93:${{ secrets.GIT_TOKEN }}@github.com/Lukasss93/telegram-stickeroptimizer.git" master
wget https://getcomposer.org/download/latest-2.x/composer.phar -O composer.phar
php8.2 composer.phar install --no-dev --optimize-autoloader --no-ansi --no-interaction --no-progress
php8.2 artisan migrate --force --step
php8.2 artisan optimize:clear
php8.2 artisan optimize
php8.2 artisan view:cache
php8.2 artisan event:cache
php8.2 artisan storage:link
php8.2 artisan nutgram:register-commands
php8.2 artisan up
echo 'DONE!'