Skip to content

Commit 5b61ae8

Browse files
committed
fix(release): prune superseded platform wheels
Signed-off-by: AlpinDale <alpindale@gmail.com>
1 parent a32327f commit 5b61ae8

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

.github/scripts/publish_platform_wheels.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ for wheel in "${wheels[@]}"; do
2929
--s3-chunk-size 64M
3030
done
3131

32+
if [[ -n "${PRUNE_RELEASE_VERSION:-}" ]]; then
33+
declare -A current_wheels=()
34+
for wheel in "${wheels[@]}"; do
35+
current_wheels["$(basename "$wheel")"]=1
36+
done
37+
38+
wheel_prefix="aphrodite_engine-${PRUNE_RELEASE_VERSION}+${backend}-"
39+
while IFS= read -r wheel_name; do
40+
[[ "$wheel_name" == "${wheel_prefix}"*.whl ]] || continue
41+
[[ -n "${current_wheels[$wheel_name]:-}" ]] && continue
42+
"$rclone" deletefile "${remote_root}/wheels/${wheel_name}"
43+
done < <("$rclone" lsf "${remote_root}/wheels" --files-only --include '*.whl')
44+
fi
45+
3246
entries="${RUNNER_TEMP:-/tmp}/sonar-${channel}-${backend}-${architecture}.tsv"
3347
: >"$entries"
3448
while IFS= read -r wheel_name; do

.github/workflows/repair-release-platform-wheels.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,11 @@ jobs:
191191
- name: Upload wheels and generate indexes
192192
env:
193193
RCLONE_BIN: ${{ runner.temp }}/rclone-bin/rclone
194+
PRUNE_RELEASE_VERSION: ${{ inputs.release_tag }}
194195
run: |
195196
set -euo pipefail
197+
PRUNE_RELEASE_VERSION="${PRUNE_RELEASE_VERSION#v}"
198+
export PRUNE_RELEASE_VERSION
196199
.github/scripts/publish_platform_wheels.sh \
197200
platform-wheels/cpu-x86_64 release cpu x86_64 page-index
198201
.github/scripts/publish_platform_wheels.sh \
@@ -204,6 +207,32 @@ jobs:
204207
env:
205208
GH_TOKEN: ${{ github.token }}
206209
run: |
210+
version="${{ inputs.release_tag }}"
211+
version="${version#v}"
212+
mapfile -t replacement_assets < <(
213+
find platform-wheels -type f -name '*.whl' -printf '%f\n'
214+
)
215+
while IFS= read -r asset; do
216+
case "$asset" in
217+
"aphrodite_engine-${version}+cpu-"*.whl|\
218+
"aphrodite_engine-${version}+metal-"*.whl)
219+
keep_asset=false
220+
for replacement_asset in "${replacement_assets[@]}"; do
221+
if [[ "$asset" == "$replacement_asset" ]]; then
222+
keep_asset=true
223+
break
224+
fi
225+
done
226+
if [[ "$keep_asset" == false ]]; then
227+
gh release delete-asset "${{ inputs.release_tag }}" \
228+
"$asset" --yes
229+
fi
230+
;;
231+
esac
232+
done < <(
233+
gh release view "${{ inputs.release_tag }}" \
234+
--json assets --jq '.assets[].name'
235+
)
207236
gh release upload "${{ inputs.release_tag }}" \
208237
platform-wheels/*/*.whl --clobber
209238

0 commit comments

Comments
 (0)