ci: resolve the Shopware version with Composer from the plugin constraint; harden the registry repack
plugin-checks / version-changelog (pull_request) Successful in 18s
plugin-checks / package (pull_request) Successful in 1m3s
plugin-checks / phpunit (pull_request) Successful in 6m14s

- phpunit: 'Resolve the latest Shopware Version' uses composer show against require.shopware/core
  from the plugin's composer.json (the Packagist scrape returned nothing on the first run)
- release: build the registry zip from an explicit file list without a leading ./ so the
  composer.json entry is stored at the zip root

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
haylanandClaude Bot committed 2026-10-04 01:05:25 +02:00
1 parent 18844718d2
commit 8b2c2278d2
3 files changed
+17 -16

No files matched your search

+11 -11
View File
@@ -98,19 +98,19 @@ jobs:
- uses: actions/checkout@v4
with:
path: plugin-src
# The cache key follows the Shopware version: a new 6.6.x release changes the key, so the old
# project + database are never reused. Bump -v1 to force a refresh by hand.
- name: Resolve the latest Shopware 6.6 version
# The cache key follows the Shopware version: a new release inside the plugin's supported range changes
# the key, so the old project + database are never reused. Bump -v1 to force a refresh by hand.
- name: Resolve the latest Shopware Version
id: sw
run: |
VERSION=$(php -r '
$all = json_decode(file_get_contents("https://repo.packagist.org/p2/shopware/production.json"), true)["packages"]["shopware/production"];
$v = [];
foreach ($all as $p) { if (preg_match("/^6\.6\.\d+(\.\d+)*$/", $p["version"])) { $v[] = $p["version"]; } }
usort($v, "version_compare");
echo end($v);')
test -n "$VERSION" || { echo "::error::could not resolve the Shopware 6.6 version"; exit 1; }
echo "Shopware ${VERSION}"
set -e
# The plugin's own constraint (require.shopware/core, e.g. ~6.6.0) decides which versions are acceptable;
# Composer lists the matching ones newest first, the first stable one is the latest.
CONSTRAINT=$(php -r 'echo json_decode(file_get_contents("plugin-src/composer.json"), true)["require"]["shopware/core"];')
VERSION=$(composer show shopware/core "$CONSTRAINT" --all --format=json --no-interaction 2>/dev/null \
| php -r '$d = json_decode(stream_get_contents(STDIN), true); foreach ($d["versions"] as $v) { if (preg_match("/^v?\d+(\.\d+)+$/", $v)) { echo ltrim($v, "v"); exit; } }')
test -n "$VERSION" || { echo "::error::could not resolve a Shopware version for ${CONSTRAINT}"; exit 1; }
echo "Shopware ${VERSION} (constraint ${CONSTRAINT})"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
# Project (vendor/, phpunit, config) and the installed database as a SQL dump. Neither depends on the plugin.
- name: Restore Shopware project and database
+2 -1
View File
@@ -126,7 +126,8 @@ jobs:
fi
test -f "$ROOT/composer.json" || { echo "::error::no composer.json found in the packaged zip"; exit 1; }
OUT="$PWD/.build/composer-${{ steps.meta.outputs.zip }}"
(cd "$ROOT" && zip -qr "$OUT" .)
# explicit file list with the leading "./" stripped, so entries are stored as "composer.json", "src/..."
(cd "$ROOT" && find . -mindepth 1 | sed 's|^\./||' | zip -q "$OUT" -@)
unzip -l "$OUT" | grep -E ' composer\.json$' > /dev/null || { echo "::error::repacked zip has no root-level composer.json"; exit 1; }
echo "repacked: $OUT"