From dde3a76d78edbc425b390d11134d80bb1c748f89 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sun, 6 Mar 2022 18:03:27 +0100 Subject: [PATCH] CI: Fix Composer root version guessing --- .github/actions/install/action.yml | 35 +++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 43275f3..046d475 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -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 }}