Skip to content

What a project needs

Update Status builds the URL it checks from two keys in a project's .info.yml: <project status url>/<project>/current. It also needs the installed version to compare with the releases. So each module, theme or install profile hosted on GitHub or GitLab needs all of the following.

What Where Example
Repository name matching the project name GitHub or GitLab github.com/example-org/my_module
project key Every .info.yml in the repository project: my_module
project status url key: the server's URL, the host and the repository's owner, without the project name Every .info.yml in the repository project status url: 'https://updates.example.com/git-release-history/github.com/example-org'
Releases tagged with version numbers GitHub or GitLab 1.2.0, 1.3.0-beta1 or 8.x-1.2
Protected N.x branches for development releases GitHub or GitLab 1.x
The installed version Set when the site runs, see below 1.2.0

Releases and branches

  • Each published release is listed by its tag. Tags that have no release, GitHub's draft releases and GitLab's upcoming releases are left out.
  • Tags must be version numbers Drupal understands, such as 1.2.0, 1.3.0-beta1 or 8.x-1.2. A v prefix (v1.2.0) isn't valid.
  • Each protected branch named like 1.x is listed as a 1.x-dev release, and marks the 1.x releases as supported. On GitLab, protected branch rules with wildcards, such as *.x, are left out: protect each branch by name.

The installed version

drupal.org adds version to .info.yml files when it packages a release, but a project installed with Composer from GitHub or GitLab has none, and Update Status can't compare it with the releases. Set it in the project itself, from Composer's installed versions, with a hook_system_info_alter() in its .module file:

use Composer\InstalledVersions;
use Drupal\Core\Extension\Extension;

/**
 * Implements hook_system_info_alter().
 */
function my_module_system_info_alter(array &$info, Extension $file, $type): void {
  // Report the installed version to Update Status, for every extension in
  // this project.
  $package = 'example-org/my_module';
  if (($info['project'] ?? NULL) === 'my_module' && empty($info['version']) && InstalledVersions::isInstalled($package)) {
    // Composer calls a branch install "dev-1.x" or "1.x-dev". Update Status
    // expects "1.x-dev".
    $info['version'] = preg_replace('/^dev-(.+)$/', '$1-dev', InstalledVersions::getPrettyVersion($package));
  }
}

Replace my_module with the project name and example-org/my_module with the project's Composer package name.

The Composer Deploy module sets version for every Composer package, but for a tagged release installed from GitHub or GitLab it only uses a version given in the package's composer.json (extra.drupal.version), and otherwise sets dev, which Update Status can't compare. It also replaces the project key with the second part of the Composer package name, so that name must match the repository name too.