Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Build scripts

No security coverage Under active development 2 sites

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
    

Ask your assistant about Build scripts

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
2
Tracked since
Apr 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Active

Releases

Version Type Core PHP Release date
2.0.0-beta2 Pre-release 8–11 Oct 1, 2025
2.0.0-beta1 Pre-release 8–10 Apr 18, 2023