From d2c9ada2453963978b89a4ee9edede826b3b1740 Mon Sep 17 00:00:00 2001 From: this-is-tobi Date: Sat, 3 Aug 2024 16:58:21 +0200 Subject: [PATCH] ci: :construction_worker: add binaries build in ci/cd --- .github/workflows/build.yml | 5 ++++- ci/scripts/delete-image.sh | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ded1b6..a01bcc5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,11 +62,14 @@ jobs: short-sha: ${{ steps.infos.outputs.SHORT_SHA }} platforms-json: ${{ steps.infos.outputs.PLATFORMS_JSON }} steps: + - name: Checks-out repository + uses: actions/checkout@v4 + - name: Get variables id: infos run: | echo "SHORT_SHA=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - echo "PLATFORMS_JSON=$(echo "$PLATFORMS"| jq -c 'split(",")')" >> $GITHUB_OUTPUT + echo "PLATFORMS_JSON=$(echo "${{ inputs.PLATFORMS }}" | jq -c 'split(",")')" >> $GITHUB_OUTPUT build-binaries: name: Build application binaries diff --git a/ci/scripts/delete-image.sh b/ci/scripts/delete-image.sh index 26a8591..9e40260 100755 --- a/ci/scripts/delete-image.sh +++ b/ci/scripts/delete-image.sh @@ -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 @@ -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 @@ -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}"