From 95648807831fe4d0332adc9b79f4459837a00d9c Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 26 Oct 2026 11:39:34 +0330 Subject: [PATCH] Don't fail the publish job when the package is already linked Co-Authored-By: Claude Sonnet 5.5 --- .gitea/workflows/ci-cd.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index b0e9ee7..7f3ff2f 100644 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -84,10 +84,15 @@ jobs: --tag "$IMAGE" . docker push "$IMAGE" - # Show the package under this repository's Packages tab. - curl --fail-with-body --silent --show-error --request POST \ + # Show the package under this repository's Packages tab. Gitea answers 400 when the package + # is already linked (every run after the first), and the image is published either way. + status="$(curl --silent --show-error --output /dev/null --write-out '%{http_code}' --request POST \ --header "Authorization: token $REGISTRY_TOKEN" \ - "https://$REGISTRY/api/v1/packages/$OWNER/container/${REPO,,}/-/link/$REPO" + "https://$REGISTRY/api/v1/packages/$OWNER/container/${REPO,,}/-/link/$REPO")" + case "$status" in + 201) echo "Linked the package to $REPO" ;; + *) echo "Package link request returned HTTP $status (already linked is normal); continuing" ;; + esac echo "image=$IMAGE" >> "$GITEA_OUTPUT" echo "Published and linked: $IMAGE"