fix(release): repack zip root-level for the Composer registry #14

Merged
haylan merged 10 commits from fix/release-registry-zip into main 2026-10-03 23:21:08 +00:00
3 changed files with 17 additions and 16 deletions
Showing only changes of commit 8b2c2278d2 - Show all commits

No files matched your search

+11 -11
View File
@@ -98,19 +98,19 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
path: plugin-src path: plugin-src
# The cache key follows the Shopware version: a new 6.6.x release changes the key, so the old # The cache key follows the Shopware version: a new release inside the plugin's supported range changes
# project + database are never reused. Bump -v1 to force a refresh by hand. # 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 - name: Resolve the latest Shopware Version
id: sw id: sw
run: | run: |
VERSION=$(php -r ' set -e
$all = json_decode(file_get_contents("https://repo.packagist.org/p2/shopware/production.json"), true)["packages"]["shopware/production"]; # The plugin's own constraint (require.shopware/core, e.g. ~6.6.0) decides which versions are acceptable;
$v = []; # Composer lists the matching ones newest first, the first stable one is the latest.
foreach ($all as $p) { if (preg_match("/^6\.6\.\d+(\.\d+)*$/", $p["version"])) { $v[] = $p["version"]; } } CONSTRAINT=$(php -r 'echo json_decode(file_get_contents("plugin-src/composer.json"), true)["require"]["shopware/core"];')
usort($v, "version_compare"); VERSION=$(composer show shopware/core "$CONSTRAINT" --all --format=json --no-interaction 2>/dev/null \
echo end($v);') | 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 the Shopware 6.6 version"; exit 1; } test -n "$VERSION" || { echo "::error::could not resolve a Shopware version for ${CONSTRAINT}"; exit 1; }
echo "Shopware ${VERSION}" echo "Shopware ${VERSION} (constraint ${CONSTRAINT})"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT" echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
# Project (vendor/, phpunit, config) and the installed database as a SQL dump. Neither depends on the plugin. # Project (vendor/, phpunit, config) and the installed database as a SQL dump. Neither depends on the plugin.
- name: Restore Shopware project and database - name: Restore Shopware project and database
+2 -1
View File
@@ -126,7 +126,8 @@ jobs:
fi fi
test -f "$ROOT/composer.json" || { echo "::error::no composer.json found in the packaged zip"; exit 1; } 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 }}" 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; } unzip -l "$OUT" | grep -E ' composer\.json$' > /dev/null || { echo "::error::repacked zip has no root-level composer.json"; exit 1; }
echo "repacked: $OUT" echo "repacked: $OUT"
+4 -4
View File
@@ -53,10 +53,10 @@ activates this plugin inside a real Shopware kernel for the test run (`KERNEL_CL
`Shopware\Core\Kernel` in `phpunit.xml`). This means tests require a working Shopware installation/DB `Shopware\Core\Kernel` in `phpunit.xml`). This means tests require a working Shopware installation/DB
to bootstrap against — they are not runnable as an isolated PHP package. to bootstrap against — they are not runnable as an isolated PHP package.
In CI (`phpunit` job) the latest Shopware 6.6 version is resolved from Packagist and the prepared project In CI (`phpunit` job) the latest Shopware version allowed by the plugin's `require.shopware/core` constraint
(`composer create-project` + phpunit, then `system:install` into `shopware_test` on a MariaDB 10.11 service) is resolved with Composer. The prepared project (`composer create-project` + phpunit, then `system:install`
plus a SQL dump of the installed database are cached under a key that contains that version, so a new into `shopware_test` on a MariaDB 10.11 service) plus a SQL dump of the installed database are cached under
Shopware release invalidates the cache. On a hit the dump is restored instead of reinstalling; the plugin a key that contains that version, so a new Shopware release invalidates the cache. On a hit the dump is restored instead of reinstalling; the plugin
is then copied into `custom/plugins` and the bootstrapper only activates it. is then copied into `custom/plugins` and the bootstrapper only activates it.
```bash ```bash