forked from et-nik/gameap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
102 lines (94 loc) · 2.96 KB
/
.drone.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
94
95
96
97
98
99
100
101
102
kind: pipeline
name: default
steps:
- name: composer
image: knik/php:7.2-fpm-stretch
commands:
- apt -y update && apt install -y git
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- name: npm
image: node
commands:
- npm install
- npm run prod
- name: tests
image: knik/php:7.2-fpm-stretch
commands:
- mv .env.example .env
- sed -i "s/DB_HOST.*$/DB_HOST=db/" .env
- php artisan key:generate --force
- php artisan migrate:fresh --seed
- vendor/bin/phpunit --verbose
- sed -i "s/DB_HOST.*$/DB_HOST=127\.0\.0\.1/" .env
- mv .env .env.example
- rm -rf storage/app/certs
- rm -rf storage/framework/cache/data/*
- rm -rf storage/framework/sessions/*
- rm -rf storage/framework/views/*
- name: composer-production
image: knik/php:7.2-fpm-stretch
commands:
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install --no-dev --optimize-autoloader
when:
branch:
- master
- name: archive
image: debian:buster
commands:
- apt update && apt -y install rsync
- mkdir gameap
- rsync -rl --exclude=/gameap --exclude=/node_modules ./ gameap/
- mkdir "publish"
- tar czf "publish/gameap-3.0.0-beta.tar.gz" "gameap"
when:
branch:
- master
- name: archive-shared
image: knik/php:7.2-fpm-stretch
commands:
- apt update && apt -y install default-mysql-client zip unzip rsync
- mkdir -p gameap-shared/upload
- mv .env.example .env
- sed -i "s/DB_HOST.*$/DB_HOST=db/" .env
- php artisan migrate:fresh --seed --force
- sed -i "s/DB_HOST.*$/DB_HOST=127\.0\.0\.1/" .env
- mysqldump -h db -u homestead -p --password=secret homestead > gameap.sql
- curl -O http://packages.gameap.ru/gameap/shared-build-artifacts.zip
- rsync -rl --exclude=/gameap --exclude=/node_modules --exclude=/shared-build-artifacts.zip ./ gameap-shared/upload/
- unzip -o shared-build-artifacts.zip -d gameap-shared
- cd gameap-shared
&& mv upload/gameap.sql gameap.sql
&& zip -r "../publish/gameap-3.0.0-beta-shared.zip" ./
when:
branch:
- master
- name: publish
image: cschlosser/drone-ftps
environment:
FTP_USERNAME:
from_secret: ftp_username
FTP_PASSWORD:
from_secret: ftp_password
settings:
hostname: packages.gameap.ru:21
secrets: [ ftp_username, ftp_password ]
secure: false
src_dir: /publish
dest_dir: /gameap
chmod: false
include:
- ^.*tar\.gz$
- ^.*zip$
when:
branch:
- master
services:
- name: db
image: mysql:5.6
environment:
MYSQL_ROOT_PASSWORD: userpass
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret