Skip to content

Commit

Permalink
let GHA bundle artifacts be cleaned up by built-in GHA retention mech…
Browse files Browse the repository at this point in the history
…anism
  • Loading branch information
dougxc committed Oct 31, 2024
1 parent c40bb76 commit ad897ac
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,48 +374,3 @@ jobs:
platform: windows-x64
bootjdk-platform: windows-x64
runs-on: windows-2019

# Remove bundles so they are not misconstrued as binary distributions from the JDK project
remove-bundles:
name: 'Remove bundle artifacts'
runs-on: ubuntu-22.04
if: always()
needs:
- build-linux-x64
- build-linux-x86-hs
- build-linux-x64-hs-nopch
- build-linux-x64-hs-zero
- build-linux-x64-hs-minimal
- build-linux-x64-hs-optimized
- build-linux-cross-compile
- build-alpine-linux-x64
- build-macos-x64
- build-macos-aarch64
- build-windows-x64
- build-windows-aarch64
- test-linux-x64
- test-macos-x64
- test-macos-aarch64
- test-windows-x64

steps:
- name: 'Remove bundle artifacts'
run: |
# Find and remove all bundle artifacts
# See: https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28
ALL_ARTIFACT_IDS="$(curl -sL \
-H 'Accept: application/vnd.github+json' \
-H 'Authorization: Bearer ${{ github.token }}' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts?per_page=100')"
BUNDLE_ARTIFACT_IDS="$(echo "$ALL_ARTIFACT_IDS" | jq -r -c '.artifacts | map(select(.name|startswith("bundles-"))) | .[].id')"
for id in $BUNDLE_ARTIFACT_IDS; do
echo "Removing $id"
curl -sL \
-X DELETE \
-H 'Accept: application/vnd.github+json' \
-H 'Authorization: Bearer ${{ github.token }}' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
"${{ github.api_url }}/repos/${{ github.repository }}/actions/artifacts/$id" \
|| echo "Failed to remove bundle"
done

0 comments on commit ad897ac

Please sign in to comment.