Deploy #40
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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!" |