From e65f3bf2e6ccdf0914ff28f2e68a29af1715d288 Mon Sep 17 00:00:00 2001 From: Alex Mickelson Date: Mon, 16 Mar 2026 16:55:52 -0600 Subject: [PATCH] jq --- .gitea/workflows/deploy.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 94a891c..29faff9 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -54,10 +54,12 @@ jobs: - name: Cleanup old images run: | # Delete all container image versions except the most recent one - VERSIONS=$(curl -s -H "Authorization: token ${{ secrets.REGISTRY_TOKEN }}" \ - "${{ env.REGISTRY }}/api/v1/packages/alexmickelson?type=container&q=cobblemon&limit=50" \ - | jq -r 'sort_by(.created) | reverse | .[1:] | .[].id') - for id in $VERSIONS; do - curl -s -X DELETE -H "Authorization: token ${{ secrets.REGISTRY_TOKEN }}" \ - "${{ env.REGISTRY }}/api/v1/packages/alexmickelson/container/cobblemon/${id}" - done + nix-shell -p jq --run ' + VERSIONS=$(curl -s -H "Authorization: token ${{ secrets.REGISTRY_TOKEN }}" \ + "${{ env.REGISTRY }}/api/v1/packages/alexmickelson?type=container&q=cobblemon&limit=50" \ + | jq -r '"'"'sort_by(.created) | reverse | .[1:] | .[].id'"'"') + for id in $VERSIONS; do + curl -s -X DELETE -H "Authorization: token ${{ secrets.REGISTRY_TOKEN }}" \ + "${{ env.REGISTRY }}/api/v1/packages/alexmickelson/container/cobblemon/${id}" + done + '