Skip to content

Commit d6283ec

Browse files
committed
IBX-656: Added comment about JQ oneliner
1 parent f92f30b commit d6283ec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.github/workflows/release_tag.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ jobs:
5656
cat > $FILE2 <<'EOF'
5757
${{ steps.currentLock.outputs.lock }}
5858
EOF
59+
# Get only changed packages and sort versions in ascending order
60+
# Step 1: Merge composer.json from two versions, grouping by .name
61+
# Step 2: Take .versions key and remove duplicate versions (means this bundle did not change)
62+
# Step 3: Select only those bundles that have more than 1 version in .versions
63+
# Step 4: Sort versions
64+
# Step 5: (outer brackets) Wrap that into JSON list of objects
65+
# Note: zzzz is added as an additional suffix to properly sort out alpha/beta/etc pre-releases (v2.5.1-alphazzzz < v2.5.1zzzz)
5966
OUT=$(jq -s 'flatten | group_by(.name)' $FILE1 $FILE2 | jq -s '[ .[][] | {name: (.[0].name), versions: [ .[0].version, .[1].version ] | unique} | select(.versions | length > 1) ] | .[].versions |= sort_by( . + "zzzz" | [scan("[0-9]+|[a-z]+")] | map(tonumber? // .) )')
6067
echo "::set-output name=matrix::$( echo "$OUT" | sed ':a;N;$!ba;s/\n/%0A/g' )"
6168

0 commit comments

Comments
 (0)