CI: Improve reusable 'install' action

This commit is contained in:
Daniel Rudolf 2022-02-19 16:38:24 +01:00
parent 23b00ba1e0
commit b9de38f7f2
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538

View file

@ -30,24 +30,11 @@ runs:
run: |
COMPOSER_ROOT_VERSION=
COMPOSER_BRANCH_ALIAS="$(php -r "
\$json = json_decode(file_get_contents('./composer.json'), true);
if (\$json !== null) {
if (isset(\$json['extra']['branch-alias']['dev-$GITHUB_REF_NAME'])) {
echo 'dev-$GITHUB_REF_NAME';
}
}
")"
if [ -z "$COMPOSER_BRANCH_ALIAS" ]; then
PICO_VERSION_PATTERN="$(php -r "
if [ -z "$(composer config extra.branch-alias."dev-$GITHUB_REF_NAME")" ]; then
COMPOSER_ROOT_VERSION="$(php -r "
require('./lib/Pico.php');
echo preg_replace('/\.[0-9]+-dev$/', '.x-dev', Pico::VERSION);
")"
fi
if [ -n "$PICO_VERSION_PATTERN" ]; then
COMPOSER_ROOT_VERSION="$PICO_VERSION_PATTERN"
echo "COMPOSER_ROOT_VERSION=$COMPOSER_ROOT_VERSION" | tee -a "$GITHUB_ENV"
fi