test(get-magento-version): document and pin what happens in various kinds of installs

This commit is contained in:
Damien Retzinger
2026-05-07 09:26:08 -04:00
parent 483ec3ac17
commit c786530c3e
11 changed files with 144 additions and 17 deletions
+1 -16
View File
@@ -22,22 +22,7 @@ runs:
- name: Compute Installed Magento version
id: get-magento-version
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
PATTERN="magento/product-(community|enterprise)-edition|mage-os/product-community-edition"
if [ -f composer.lock ]; then
RESULT=$(jq -r --arg p "$PATTERN" '.packages[] | select(.name | test($p)) | "\(.name) \(.version)"' composer.lock | head -1)
else
RESULT=$(jq -r --arg p "$PATTERN" '.require | to_entries[] | select(.key | test($p)) | "\(.key) \(.value)"' composer.json | head -1)
fi
PRODUCT=$(echo "$RESULT" | awk '{print $1}')
VERSION=$(echo "$RESULT" | awk '{print $2}' | sed 's/^v//')
PROJECT=$(echo "$PRODUCT" | sed 's/product-/project-/')
echo "version=\"$VERSION\"" >> $GITHUB_OUTPUT
echo "project=$PROJECT" >> $GITHUB_OUTPUT
run: bash "${{ github.action_path }}/get-magento-version.sh" "${{ inputs.working-directory }}" >> $GITHUB_OUTPUT
branding:
icon: "code"