Skip to content

Commit

Permalink
ci: 👷 add binaries build in ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-tobi committed Aug 3, 2024
1 parent 3e9de90 commit 66621d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ci/scripts/delete-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ IMAGE_NAME_URL_ENCODED="$(jq -rn --arg x ${IMAGE_NAME} '$x | @uri')"
IMAGES=$(curl -s \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/users/${ORG}/packages/container/${IMAGE_NAME_URL_ENCODED}/versions?per_page=100")
MAIN_IMAGE_ID=$(echo "$IMAGES" | jq -r --arg t "$TAG" '.[] | select(.labels["org.opencontainers.image.version"] == $t) | .id')
MAIN_IMAGE_ID=$(echo "$IMAGES" | jq -r --arg t "$TAG" '.[] | select(.metadata.container.tags[] | contains($t)) | .id')

# Delete subsequent images
while read -r SHA; do
Expand All @@ -87,7 +87,7 @@ while read -r SHA; do
curl -s \
-X DELETE \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/user/${ORG}/packages/container/${IMAGE_NAME_URL_ENCODED}/versions/${IMAGE_ID}"
"https://api.github.com/users/${ORG}/packages/container/${IMAGE_NAME_URL_ENCODED}/versions/${IMAGE_ID}"
done <<< "$(docker buildx imagetools inspect ghcr.io/${ORG}/${IMAGE_NAME}:${TAG} --raw | jq -r '.manifests[] | .digest')"

# Delete main image
Expand All @@ -96,4 +96,4 @@ printf "\n${red}[Delete ghcr image].${no_color} Deleting image '$ORG/$IMAGE_NAME
curl -s \
-X DELETE \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/user/${ORG}/packages/container/${IMAGE_NAME_URL_ENCODED}/versions/${MAIN_IMAGE_ID}"
"https://api.github.com/users/${ORG}/packages/container/${IMAGE_NAME_URL_ENCODED}/versions/${MAIN_IMAGE_ID}"

0 comments on commit 66621d0

Please sign in to comment.