-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·31 lines (26 loc) · 1.05 KB
/
deploy.sh
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
#! /bin/bash
# Запускать каждый раз при изменениях в коде для заливки новой версии в Яндекс.Облако
# Не заливай, если нет conf/jobs.php
if [ ! -f "$(pwd)/conf/jobs.php" ]; then
echo 'Error: conf/jobs.php is missing. Create conf/jobs.php from conf/jobs.php.dist.'
exit 1
fi
# Информируй о несоответствии PSR-12
./vendor/bin/phpcs --standard=PSR12 src/ tests/
# Не создавай версию, если тесты не проходят
./vendor/bin/phpunit
if [ $? -eq 0 ]; then
rm -f butler.zip
zip -r butler.zip src index.php conf/jobs.php composer.json composer.lock
# Справка https://cloud.yandex.ru/docs/functions/operations/function/version-manage
yc serverless function version create \
--function-name=butler \
--runtime php74 \
--entrypoint index.main \
--memory 128m \
--execution-timeout 1s \
--source-path ./butler.zip
else
echo "Error: unit tests failed. Fix bugs or tests."
exit 1
fi