Skip to content

Commit 5661daa

Browse files
committed
feat(release): custom install.sh with variant + binary selection
1 parent f7c669e commit 5661daa

2 files changed

Lines changed: 324 additions & 67 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -312,23 +312,13 @@ jobs:
312312
- name: Assemble unified INSTALL.md + install.sh
313313
working-directory: dist
314314
run: |
315-
# Each per-slice bundle ships its own INSTALL-<slice>.md /
316-
# install-<slice>.sh whose only slice-specific bit is the
317-
# arch/format table (resp. file_for() cases + list_entries
318-
# body). The static prose, env vars, help text etc. are
319-
# identical across slices. So: take the first slice as the
320-
# template, then splice in the union of per-slice table rows
321-
# / cases / list lines from every slice. One unified
322-
# INSTALL.md, one unified install.sh — both arch-agnostic.
323-
315+
# The bundler ships one INSTALL-<slice>.md per slice whose only
316+
# slice-specific bit is the arch/format bundle table. Merge the
317+
# tables from every slice into a single canonical INSTALL.md.
324318
shopt -s nullglob
325319
md_slices=(INSTALL-*.md)
326-
sh_slices=(install-*.sh)
327-
328320
if [ "${#md_slices[@]}" -gt 0 ]; then
329321
template="${md_slices[0]}"
330-
# Pull the union of "| arch | os | format | file |" rows from
331-
# every slice's "Bundles in this release" table. Dedupe.
332322
{
333323
for f in "${md_slices[@]}"; do
334324
awk '/^\| Arch \| OS \| Format \| File \|$/{t=1; next}
@@ -338,7 +328,6 @@ jobs:
338328
done
339329
} | LC_ALL=C sort -u > .bundle-rows
340330
341-
# Splice the union back into the template's table location.
342331
awk -v rows=.bundle-rows '
343332
/^\| Arch \| OS \| Format \| File \|$/{
344333
print
@@ -356,63 +345,18 @@ jobs:
356345
rm -f .bundle-rows
357346
fi
358347
359-
if [ "${#sh_slices[@]}" -gt 0 ]; then
360-
template_sh="${sh_slices[0]}"
361-
# Union of file_for() case bodies (between `case "$1" in` and
362-
# `*) return 1 ;;`). Lines look like
363-
# "x86_64:Linux:archlinux") echo "..."; return ;;
364-
{
365-
for f in "${sh_slices[@]}"; do
366-
awk '/^file_for\(\) \{/{f=1; next}
367-
f && /case "\$1" in/{c=1; next}
368-
c && /\*\) return 1/{exit}
369-
c{print}' "$f"
370-
done
371-
} | LC_ALL=C sort -u > .sh-cases
372-
373-
# Union of list_entries() body — the human-readable
374-
# "Configured bundles" listing inside the heredoc.
375-
{
376-
for f in "${sh_slices[@]}"; do
377-
awk '/^list_entries\(\) \{/{f=1; next}
378-
f && /Configured bundles:/{c=1; next}
379-
c && /^EOF$/{exit}
380-
c{print}' "$f"
381-
done
382-
} | LC_ALL=C sort -u > .sh-list
383-
384-
awk -v cases=.sh-cases -v listing=.sh-list '
385-
/^file_for\(\) \{/{print; in_ff=1; next}
386-
in_ff && /case "\$1" in/{
387-
print
388-
while ((getline line < cases) > 0) print line
389-
close(cases)
390-
in_cases=1
391-
next
392-
}
393-
in_cases && /\*\) return 1/{in_cases=0; in_ff=0}
394-
in_cases{next}
395-
/^list_entries\(\) \{/{print; in_le=1; next}
396-
in_le && /Configured bundles:/{
397-
print
398-
while ((getline line < listing) > 0) print line
399-
close(listing)
400-
in_list=1
401-
next
402-
}
403-
in_list && /^EOF$/{in_list=0; in_le=0}
404-
in_list{next}
405-
{print}
406-
' "$template_sh" > install.sh
407-
chmod +x install.sh
408-
rm -f .sh-cases .sh-list
409-
fi
348+
# install.sh ships as a tracked script in `scripts/install.sh`
349+
# rather than the bundler-generated one. Reasons: the bundler
350+
# variant emits one script per slice with hardcoded `NAME=` and
351+
# duplicate `file_for()` cases that make variant selection
352+
# impossible. Our custom script resolves variant + version via
353+
# flags and the GH releases API.
354+
cp ../scripts/install.sh install.sh
355+
chmod +x install.sh
410356
411357
rm -f INSTALL-*.md install-*.sh install-*.ps1
412358
echo "--- INSTALL.md preview ---"
413359
head -60 INSTALL.md
414-
echo "--- install.sh file_for() preview ---"
415-
awk '/^file_for/,/^\}/' install.sh
416360
417361
- name: Pack AUR layouts for downstream workflow
418362
id: aur_detect

0 commit comments

Comments
 (0)