Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Build scripts

2 sites No security coverage
View on drupal.org

This module allows you to trigger custom scripts directly from the Drupal user interface. It's designed to initiate builds, such as generating a static Gatsby site from your Drupal content, and can be adapted for various purposes by configuring environments and passing arguments to external shell scripts.

Build scripts is a module that adds functionality to run scripts from within Drupal user interface (for example to build a static site). This module is built for running Gatsby builds, but is very customizable and can be adapted to many different purposes. The module communicates with external build daemon and does nothing without it.

Our motivation for this project is that we want a button to our site that runs a script which builds a static Gatsby site from our Drupal data. Additionally we want it to support separate testing environment that our editors can use to check how their work looks on the Gatsby site.

This module has configurable environments that are passed to a shell script with current Drupal language as arguments. The shell script does most of the work.

Installation (for Gatsby)

  1. Install build daemon to you server according to README.
  2. Create a shell script that is responsible for the build (see README on build daemon):
    #!/usr/bin/env bash
    
    if [ ! $# -eq 2 ]; then
            printf "Invalid arguments\n" >&2
            exit 1
    fi
    
    ENVIRONMENT="$1"
    LANGUAGE="$2"
    LOCKFILE="/tmp/build-$LANGUAGE.lock" # Only one build per language is allowed
    GATSBY_DIR="/var/www/gatsby/$LANGUAGE/"
    WWW_DIR="/var/www/frontend/$LANGUAGE/$ENVIRONMENT/"
    
    echo "starting build for $ENVIRONMENT environment"
    cd "$GATSBY_DIR"
    
    # Better format for loggin Gatsby commands:
    export CI='true'
    
    # Prevent building multiple environments simultaneously.
    if ! mkdir "$LOCKFILE"; then
            printf "Failed to acquire lock.\n" >&2
            exit 1
    fi
    trap "rm -rf $LOCKFILE" EXIT  # remove the lockdir on exit
    if npx gatsby build && rsync -a --delete "$GATSBY_DIR/public/" "$WWW_DIR"; then
            echo "Build succeeded"
    else
            echo "Build failed :("
    	exit 1
    fi
    

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Oct 2025
Latest release
10 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
2.0.0-beta2 Pre-release 8–11 Oct 1, 2025