[CI] fix asset (#245)

This commit is contained in:
Berk
2026-07-16 01:05:28 +03:00
committed by GitHub
parent f69fdd4027
commit ad5a7d3799

View File

@@ -118,7 +118,7 @@ jobs:
run: | run: |
New-Item -ItemType Directory -Path $env:RELEASE_DIR -Force | Out-Null New-Item -ItemType Directory -Path $env:RELEASE_DIR -Force | Out-Null
$archiveName = "sharpemu-${{ needs.init.outputs.version }}-win-x64-${{ needs.init.outputs.short-sha }}.zip" $archiveName = "sharpemu-${{ needs.init.outputs.version }}-win-x64.zip"
$archivePath = Join-Path $env:RELEASE_DIR $archiveName $archivePath = Join-Path $env:RELEASE_DIR $archiveName
if (Test-Path $archivePath) { if (Test-Path $archivePath) {
Remove-Item $archivePath -Force Remove-Item $archivePath -Force
@@ -130,7 +130,7 @@ jobs:
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
with: with:
name: sharpemu-win-x64-${{ needs.init.outputs.short-sha }} name: sharpemu-win-x64-${{ needs.init.outputs.short-sha }}
path: ${{ env.RELEASE_DIR }}\sharpemu-${{ needs.init.outputs.version }}-win-x64-${{ needs.init.outputs.short-sha }}.zip path: ${{ env.RELEASE_DIR }}\sharpemu-${{ needs.init.outputs.version }}-win-x64.zip
if-no-files-found: error if-no-files-found: error
build-posix: build-posix:
@@ -187,14 +187,14 @@ jobs:
run: | run: |
mkdir -p "$RELEASE_DIR" mkdir -p "$RELEASE_DIR"
# tar keeps the executable bit, which zip would drop. # tar keeps the executable bit, which zip would drop.
tar -czf "$RELEASE_DIR/sharpemu-${{ needs.init.outputs.version }}-${{ matrix.rid }}-${{ needs.init.outputs.short-sha }}.tar.gz" \ tar -czf "$RELEASE_DIR/sharpemu-${{ needs.init.outputs.version }}-${{ matrix.rid }}.tar.gz" \
-C "$PUBLISH_DIR" . -C "$PUBLISH_DIR" .
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
with: with:
name: sharpemu-${{ matrix.rid }}-${{ needs.init.outputs.short-sha }} name: sharpemu-${{ matrix.rid }}-${{ needs.init.outputs.short-sha }}
path: ${{ env.RELEASE_DIR }}/sharpemu-${{ needs.init.outputs.version }}-${{ matrix.rid }}-${{ needs.init.outputs.short-sha }}.tar.gz path: ${{ env.RELEASE_DIR }}/sharpemu-${{ needs.init.outputs.version }}-${{ matrix.rid }}.tar.gz
if-no-files-found: error if-no-files-found: error
release: release:
@@ -239,3 +239,18 @@ jobs:
--notes "${notes}" \ --notes "${notes}" \
--target "${GITHUB_SHA}" --target "${GITHUB_SHA}"
fi fi
keep=()
for asset_path in "${assets[@]}"; do
keep+=("$(basename "${asset_path}")")
done
mapfile -t release_assets < <(gh release view "${RELEASE_TAG}" --json assets --jq '.assets[].name' | sort)
for asset in "${release_assets[@]}"; do
case "${asset}" in
sharpemu-${VERSION}-*.zip|sharpemu-${VERSION}-*.tar.gz)
if ! printf '%s\n' "${keep[@]}" | grep -Fxq "${asset}"; then
gh release delete-asset "${RELEASE_TAG}" "${asset}" --yes
fi
;;
esac
done