#!/usr/bin/env php [0-9a-z]+)\s+\S+\\/v(?[0-9.]+)/', shell_exec('git ls-remote --tags https://github.com/cucumber/cucumber.git | grep cucumber-gherkin | sort --version-sort -k2 | tail -n 1'), $matches )) { echo "ERROR: Could not parse the repository tags\n"; exit(1); } ['hash' => $newHash, 'tag' => $newTag] = $matches; echo "Latest remote hash is {$newHash} (tagged {$newTag})\n"; if ($matches['hash'] == $oldHash) { echo "Hashes match, nothing to do\n"; exit(0); } $newJson = str_replace( [$oldHash, 'dev-gherkin-'.$oldTag], [$newHash, 'dev-gherkin-'.$newTag], $composerConfig ); file_put_contents($composerFile, $newJson); echo "Updated composer config:\n$newJson"; echo "::set-output name=cucumber_version::$newTag\n";