CI: Fix Composer root version guessing

This commit is contained in:
Daniel Rudolf 2022-03-06 18:03:27 +01:00
parent 070714d1d8
commit dde3a76d78
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538

View file

@ -35,21 +35,6 @@ runs:
run: |
composer config --global github-oauth.github.com "${{ github.token }}"
- name: Setup Composer root version
if: ${{ github.ref_type == 'branch' }}
shell: bash
working-directory: ${{ inputs.path }}
run: |
COMPOSER_ROOT_VERSION=
if [ -z "$(composer config extra.branch-alias."dev-${GITHUB_HEAD_REF:-GITHUB_REF_NAME}" 2> /dev/null)" ]; then
COMPOSER_ROOT_VERSION="$(php -r "
require('./lib/Pico.php');
echo preg_replace('/\.[0-9]+-dev$/', '.x-dev', Pico::VERSION);
")"
echo "COMPOSER_ROOT_VERSION=$COMPOSER_ROOT_VERSION" | tee -a "$GITHUB_ENV"
fi
- name: Get Composer cache directory
shell: bash
working-directory: ${{ inputs.path }}
@ -65,6 +50,26 @@ runs:
restore-keys: |
${{ runner.os }}-composer-
- name: Setup Composer root version
if: ${{ github.ref_type == 'branch' }}
shell: bash
working-directory: ${{ inputs.path }}
run: |
COMPOSER_ROOT_VERSION=
COMPOSER_ROOT_VERSION="$(composer config \
extra.branch-alias."dev-${GITHUB_HEAD_REF:-GITHUB_REF_NAME}" \
2> /dev/null)"
if [ -z "$COMPOSER_ROOT_VERSION" ]; then
COMPOSER_ROOT_VERSION="$(php -r "
require('./lib/Pico.php');
echo preg_replace('/\.[0-9]+-dev$/', '.x-dev', Pico::VERSION);
")"
fi
echo "COMPOSER_ROOT_VERSION=$COMPOSER_ROOT_VERSION" | tee -a "$GITHUB_ENV"
- name: Install Composer dependencies
shell: bash
working-directory: ${{ inputs.path }}