ci(build-packages): wire env: for discover inputs + tighten find pattern

Follow-up to the previous matrix-cap fix:

1. YAML/shell quoting hell: the inline ${{ github.event.inputs.arch }}
   substitution inside a single-quoted heredoc broke parsing on push:tags
   events (where inputs are null). Moved both inputs to step `env:` block
   so the shell script reads them as ordinary env vars.

2. Find pattern was `-name control -path "*/debian/*"`, which also matched
   dpkg-build artifacts at `packages/<pkg>/debian/<pkg>/DEBIAN/control` on
   any non-clean checkout. CI's runners are clean so it worked there, but
   the pattern is fragile. Tightened to `-path "*/debian/control" -not
   -path "*/debian/*/DEBIAN/control"`.

Verified locally: 132 amd64 + 2 arm64-eligible = 134 combos, well under
GH Actions' 256 jobs-per-matrix cap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-05-17 09:07:21 +02:00
parent 082ffccbd6
commit 8d02cdc97b

View File

@ -48,21 +48,24 @@ jobs:
- name: Find packages + build flat matrix
id: find
env:
REQUESTED_ARCH: ${{ github.event.inputs.arch }}
REQUESTED_PKG: ${{ github.event.inputs.package }}
run: |
set -euo pipefail
# Still emit the legacy `packages` output for backwards compat.
packages=$(find packages/secubox-* -name "control" -path "*/debian/*" \
packages=$(find packages/secubox-* -path "*/debian/control" -not -path "*/debian/*/DEBIAN/control" \
| xargs dirname | xargs dirname | xargs -n1 basename \
| sort | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "packages=$packages" >> "$GITHUB_OUTPUT"
echo "Found packages: $packages"
# Build the flat {package, arch} matrix. Honour the workflow_dispatch
# `arch` and `package` filters if set.
requested_arch='${{ github.event.inputs.arch || '''' }}'
requested_pkg='${{ github.event.inputs.package || '''' }}'
# `arch` and `package` filters if set (empty on `push: tags` events).
requested_arch="${REQUESTED_ARCH:-}"
requested_pkg="${REQUESTED_PKG:-}"
combos=$(find packages/secubox-* -name "control" -path "*/debian/*" \
combos=$(find packages/secubox-* -path "*/debian/control" -not -path "*/debian/*/DEBIAN/control" \
| sort | while read -r ctrl; do
pkg=$(basename "$(dirname "$(dirname "$ctrl")")")
if [ -n "$requested_pkg" ] && [ "$requested_pkg" != "$pkg" ]; then