Skip to content

Commit aecf4c4

Browse files
Copilotawalsh128
authored andcommitted
Fix create-release CI failure: consolidate release artifacts and restrict to workflow_dispatch only
1 parent 9f817f3 commit aecf4c4

2 files changed

Lines changed: 68 additions & 10 deletions

File tree

.github/workflows/build-distribute.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ on:
66
branches:
77
- dev-v2
88
workflow_call:
9-
inputs:
10-
create_release:
11-
description: 'Create a GitHub release (disabled by default for dry-run/PR builds)'
12-
default: false
13-
type: boolean
9+
workflow_dispatch:
1410
permissions:
1511
contents: write
1612
id-token: write
@@ -78,7 +74,7 @@ jobs:
7874
create-release:
7975
needs: build-and-release
8076
runs-on: ubuntu-latest
81-
if: success() && (github.event_name != 'workflow_call' || inputs.create_release == true)
77+
if: success() && github.event_name == 'workflow_dispatch'
8278
steps:
8379
- name: Checkout
8480
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
@@ -96,17 +92,17 @@ jobs:
9692
- name: Reorganize artifacts
9793
run: |
9894
./scripts/distribute.sh reorganize-artifacts
95+
- name: Consolidate release artifacts
96+
run: |
97+
./scripts/distribute.sh consolidate-release
9998
- name: Create or update release
10099
uses: softprops/action-gh-release@2bb465e97f322d3cb2a965294d483e0d26a67aa9 # v3.0.1
101100
with:
102101
tag_name: ${{ steps.version.outputs.version }}
103102
name: "${{ steps.version.outputs.version }}"
104103
generate_release_notes: true
105104
files: |
106-
distribute/x64/*
107-
distribute/arm64/*
108-
distribute/arm/*
109-
distribute/x86/*
105+
distribute/release/*
110106
draft: false
111107
prerelease: true
112108
env:

scripts/distribute.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,67 @@ 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+
mkdir -p "${RELEASE_DIR}"
178+
echo "Consolidating release artifacts into ${RELEASE_DIR}..."
179+
180+
# Find first available arch directory to source common files from.
181+
FIRST_ARCH_DIR=""
182+
for arch_dir in distribute/x64 distribute/arm64 distribute/arm distribute/x86; do
183+
if [[ -d "${arch_dir}" ]]; then
184+
FIRST_ARCH_DIR="${arch_dir}"
185+
break
186+
fi
187+
done
188+
189+
if [[ -z "${FIRST_ARCH_DIR}" ]]; then
190+
echo "Error: No architecture directories found under distribute/" >&2
191+
exit 1
192+
fi
193+
194+
# Copy common files (everything except arch-specific binaries and checksums)
195+
# from the first arch directory.
196+
shopt -s nullglob
197+
for f in "${FIRST_ARCH_DIR}"/*; do
198+
filename="$(basename "${f}")"
199+
if [[ "${filename}" == apt_query-* ]] || [[ "${filename}" == checksums.txt ]]; then
200+
continue
201+
fi
202+
cp "${f}" "${RELEASE_DIR}/"
203+
echo "Copied common file: ${filename}"
204+
done
205+
shopt -u nullglob
206+
207+
# Copy architecture-specific binaries from every arch directory.
208+
shopt -s nullglob
209+
for arch_dir in distribute/x64 distribute/arm64 distribute/arm distribute/x86; do
210+
[[ -d "${arch_dir}" ]] || continue
211+
for binary in "${arch_dir}"/apt_query-*; do
212+
cp "${binary}" "${RELEASE_DIR}/"
213+
echo "Copied binary: $(basename "${binary}")"
214+
done
215+
done
216+
shopt -u nullglob
217+
218+
# Generate a combined checksums file for all release assets.
219+
(cd "${RELEASE_DIR}" && find . -maxdepth 1 -type f ! -name "checksums.txt" \
220+
-exec sha256sum {} + | sed 's|\./||' | sort > checksums.txt)
221+
echo "Generated combined checksums:"
222+
cat "${RELEASE_DIR}/checksums.txt"
223+
224+
echo "Consolidation complete. Release directory contents:"
225+
ls -la "${RELEASE_DIR}/"
226+
;;
227+
167228
*)
168229
echo "Error: Unknown command: ${COMMAND}" >&2
169230
echo "Usage: distribute.sh <command> [args...]" >&2
@@ -175,6 +236,7 @@ case "${COMMAND}" in
175236
echo " generate-checksums <arch>" >&2
176237
echo " verify-build <arch>" >&2
177238
echo " reorganize-artifacts" >&2
239+
echo " consolidate-release" >&2
178240
exit 1
179241
;;
180242

0 commit comments

Comments
 (0)