@@ -164,6 +164,68 @@ case "${COMMAND}" in
164164 echo " Artifact reorganization complete"
165165 ;;
166166
167+ # ##############################################################################
168+ # Consolidate all per-architecture artifacts into a single flat
169+ # distribute/release/ directory for upload to GitHub Releases.
170+ # Common files (shell scripts, action.yml, apt-fast) are copied once from the
171+ # first available architecture directory. Architecture-specific binaries
172+ # (apt_query-*) are copied from every architecture directory. A combined
173+ # checksums.txt is generated at the end.
174+ # ##############################################################################
175+ consolidate-release)
176+ RELEASE_DIR=" distribute/release"
177+ ARCH_DIRS=(distribute/x64 distribute/arm64 distribute/arm distribute/x86)
178+ mkdir -p " ${RELEASE_DIR} "
179+ echo " Consolidating release artifacts into ${RELEASE_DIR} ..."
180+
181+ # Find first available arch directory to source common files from.
182+ FIRST_ARCH_DIR=" "
183+ for arch_dir in " ${ARCH_DIRS[@]} " ; do
184+ if [[ -d " ${arch_dir} " ]]; then
185+ FIRST_ARCH_DIR=" ${arch_dir} "
186+ break
187+ fi
188+ done
189+
190+ if [[ -z " ${FIRST_ARCH_DIR} " ]]; then
191+ echo " Error: No architecture directories found under distribute/" >&2
192+ exit 1
193+ fi
194+
195+ # Copy common files (everything except arch-specific binaries and checksums)
196+ # from the first arch directory.
197+ shopt -s nullglob
198+ for f in " ${FIRST_ARCH_DIR} " /* ; do
199+ filename=" $( basename " ${f} " ) "
200+ if [[ " ${filename} " == apt_query-* ]] || [[ " ${filename} " == checksums.txt ]]; then
201+ continue
202+ fi
203+ cp " ${f} " " ${RELEASE_DIR} /"
204+ echo " Copied common file: ${filename} "
205+ done
206+ shopt -u nullglob
207+
208+ # Copy architecture-specific binaries from every arch directory.
209+ shopt -s nullglob
210+ for arch_dir in " ${ARCH_DIRS[@]} " ; do
211+ [[ -d " ${arch_dir} " ]] || continue
212+ for binary in " ${arch_dir} " /apt_query-* ; do
213+ cp " ${binary} " " ${RELEASE_DIR} /"
214+ echo " Copied binary: $( basename " ${binary} " ) "
215+ done
216+ done
217+ shopt -u nullglob
218+
219+ # Generate a combined checksums file for all release assets.
220+ (cd " ${RELEASE_DIR} " && find . -maxdepth 1 -type f ! -name " checksums.txt" \
221+ -exec sha256sum {} + | sed ' s|\./||' | sort > checksums.txt)
222+ echo " Generated combined checksums:"
223+ cat " ${RELEASE_DIR} /checksums.txt"
224+
225+ echo " Consolidation complete. Release directory contents:"
226+ ls -la " ${RELEASE_DIR} /"
227+ ;;
228+
167229 * )
168230 echo " Error: Unknown command: ${COMMAND} " >&2
169231 echo " Usage: distribute.sh <command> [args...]" >&2
@@ -175,6 +237,7 @@ case "${COMMAND}" in
175237 echo " generate-checksums <arch>" >&2
176238 echo " verify-build <arch>" >&2
177239 echo " reorganize-artifacts" >&2
240+ echo " consolidate-release" >&2
178241 exit 1
179242 ;;
180243
0 commit comments