packaging: drop assets that aren't there, instead of trusting nullglob
`d77a798` added the Android client to publish-release.sh's asset list and broke the desktop lane's publish, which had been working (run 4094, curl exit 26 — "couldn't read local file"). The Android lane published fine, which is what made the shape of the mistake clear. `shopt -s nullglob` drops PATTERNS that match nothing. The two entries I added — `android/dist/thoughtsync.apk` and its sidecar — contain no wildcard, so they are not patterns at all: globbing leaves them in the array verbatim and curl is handed a path to a file that does not exist. In the Android job those files are there, so it worked; in the desktop job they never are, so it did not. Every entry is now filtered on existence, which is what the array has always meant. That covers the literal paths and the globs alike, rather than relying on each future entry containing a `*` to be safe — the trap that just cost a run. Verified both ways before pushing: a literal missing path survives nullglob and is removed by the filter, and an all-empty result still exits cleanly under `set -u`.
This commit is contained in:
@@ -74,6 +74,18 @@ ASSETS=(
|
||||
"$REPO_ROOT"/android/dist/thoughtsync.apk
|
||||
"$REPO_ROOT"/android/dist/thoughtsync-android.json
|
||||
)
|
||||
# nullglob drops PATTERNS that match nothing — it does nothing for a path with no
|
||||
# wildcard in it, which stays in the array as a literal and reaches curl as a file
|
||||
# that isn't there (exit 26). The Android entries above are exactly that shape, and
|
||||
# adding them broke the desktop publish that had been working. Filter on existence
|
||||
# instead, which is what the array actually means and covers every entry rather
|
||||
# than only the ones that happen to contain a `*`.
|
||||
present=()
|
||||
for a in "${ASSETS[@]}"; do
|
||||
[ -f "$a" ] && present+=("$a")
|
||||
done
|
||||
ASSETS=("${present[@]}")
|
||||
|
||||
if [ ${#ASSETS[@]} -eq 0 ]; then
|
||||
echo "ERROR: nothing to publish — no desktop bundles under $BUNDLE_ROOT and no APK under $REPO_ROOT/android/dist." >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user