smalot/drupal-console-build

Expose new commands to Drupal Console to run builds using a config file.

v0.2 2017-02-23 09:46 UTC

This package is not auto-updated.

Last update: 2024-12-21 22:08:14 UTC


README

Expose new commands to Drupal Console to run builds using a config file.

Latest Stable Version Latest Unstable Version License composer.lock

Total Downloads Monthly Downloads Daily Downloads

Setup

Include this library in your Drupal project:

composer require "smalot/drupal-console-build:*"

Must be added in your settings.yml file.

services:
  console.deploy_run:
    class: Smalot\Drupal\Console\Build\Command\RunCommand
    arguments: []
    tags:
      - { name: drupal.command }

  console.deploy_list:
    class: Smalot\Drupal\Console\Build\Command\ListCommand
    arguments: []
    tags:
      - { name: drupal.command }

Sample config file

File: .build.yml should be at the same folder level as the .git/.

# List stages enabled
stages:
    - compile
    - cache
    - features

# Commands section
compile_css:
    stage: compile
    script:
        - echo "Compile SASS file into CSS"
        - compass build
    allow_failure: true

cache_rebuild:
    stage: cache
    script:
        - echo "Cache Rebuild"
        - cd web && drush cache-rebuild

features_revert:
    stage: features
    script:
        - echo "Features revert all"
        - cd web && drush fra -y
    except:
        - master

Settings

stages allows to group commands and to order them during process. If stages entry is specified, all commands without stage attribute won't be run.

Both only and except accepts regex patterns (must be surrounded by backslash /). You can't specify only and except at the same time.

command:
    only:
        - "/^fix-.*$/i"

The allow_failure will report a command in error, but won't stop future commands. Otherwise, the whole build will stop at the first command line error.

Usage

Run all tasks

drupal build:run

Run all tasks of one stage

drupal build:run --stage=cache

Run specific tasks

drupal build:run compile_css cache_rebuild