Skip to content

Instantly share code, notes, and snippets.

View CybotTM's full-sized avatar

Sebastian Mendel CybotTM

View GitHub Profile
@CybotTM
CybotTM / checkout-packages.php
Last active September 24, 2020 08:31
GitLab composer registry install from source workaround
<?php
$composerJson = json_decode(file_get_contents(__DIR__ . 'composer.json'), true);
$mappings = $composerJson['config']['extra']['sources-mapping'];
foreach ($mappings as $package => $repository) {
$packageInfo = shell_exec("composer info --format=json $package");
if ($packageJson = json_decode($packageInfo, true)) {
$path = $packageJson['path'];
$version = str_replace('dev-', '', reset($packageJson['versions']));
@CybotTM
CybotTM / get_latest_release.md
Last active October 18, 2023 09:14 — forked from lukechilds/get_latest_release.sh
Shell command one-liner - To get latest or highest release from GitHub

One-liner to retrieve latest highest release (of a specific major version) from GitHub

Just retrieving the latest release may not what you want - An LTS v1.1.20 maybe released after another LTS v2.0.10

Get highest available version

Example to get highest version, not just latest - because an LTS bugfix 1.2.3 could be released after a new major 3.x version

curl https://api.github.com/repos/docker/compose/releases -s | jq -r .[].tag_name | grep '^v*[0-9]\.[0-9]*\.[0-9]*$' | sort -rV | head -n1