Don't fail the publish job when the package is already linked
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -84,10 +84,15 @@ jobs:
|
|||||||
--tag "$IMAGE" .
|
--tag "$IMAGE" .
|
||||||
docker push "$IMAGE"
|
docker push "$IMAGE"
|
||||||
|
|
||||||
# Show the package under this repository's Packages tab.
|
# Show the package under this repository's Packages tab. Gitea answers 400 when the package
|
||||||
curl --fail-with-body --silent --show-error --request POST \
|
# 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" \
|
--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 "image=$IMAGE" >> "$GITEA_OUTPUT"
|
||||||
echo "Published and linked: $IMAGE"
|
echo "Published and linked: $IMAGE"
|
||||||
|
|||||||
Reference in New Issue
Block a user