Skip to content

Finalise deployment #18

Finalise deployment

Finalise deployment #18

Workflow file for this run

name: Deployment
on:
workflow_dispatch:
push:
branches:
- main
- production
jobs:
deploy:
name: Deploy
runs-on: ubuntu-20.04
environment: ${{ github.ref == 'refs/heads/production' && 'production' || 'staging' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo
- name: Download dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--optimize-autoloader"
- name: Install assets
run: bin/console importmap:install
- name: Build assets (SASS)
run: bin/console sass:build
- name: Compile asset map
run: bin/console asset-map:compile
- name: Deploy files over SSH
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rlgoDzvcC -i --delete --chown=admin:www-data"
SOURCE: "/"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.REMOTE_TARGET }}
EXCLUDE: "/var/, /.github/, /tests/, /tools/, .env"
- name: Execute remote ssh commands to finalise deployment
uses: appleboy/[email protected]
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: ${{ secrets.DOCKER_COMPOSE_EXEC_COMMAND }} bin/post-deploy