-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (51 loc) · 1.9 KB
/
deploy.yml
File metadata and controls
68 lines (51 loc) · 1.9 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# deploy app to the production server
name: Deploy
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
# deploy to the server using SSH
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
# script to run on the server
script: |
# temporary disable monitoring
php /services/website/admin-suite/bin/console app:monitoring:temporary:disable "paste.becvar.xyz" 5
# go to the project directory
cd /services/website/code-paste
# stop web server
php bin/console app:toggle:maintenance true
sudo systemctl stop apache2
# clear requirements & cache
sudo sh scripts/clear.sh
# pull the latest changes
git pull
# set the environment to production
sed -i 's/^\(APP_ENV=\)dev/\1prod/' .env
# install dependencies
composer install --no-interaction --no-progress
# install node-modules frontend packages
npm install --loglevel=error
# build assets
npm run build
# migrate database to latest version
php bin/console doctrine:database:create --if-not-exists
php bin/console doctrine:migrations:migrate --no-interaction
# fix storage permissions
sudo chmod -R 777 var/
sudo chown -R www-data:www-data var/
# start apache
sudo systemctl start apache2
php bin/console app:toggle:maintenance false
# send push notifications to users
php /services/website/admin-suite/bin/console app:notifications:send "[Actions]: new code-paste release deployed!"