Update worckflow
All checks were successful
Build and Push Docker Image (Simple) / build-and-push (push) Successful in 19s

This commit is contained in:
jafreli
2025-07-19 01:34:17 +02:00
parent 25c42c728c
commit 9476f1bde2

View File

@@ -51,28 +51,46 @@ jobs:
echo "⏳ Waiting for package registration..."
sleep 15
# Get package information to verify it exists
# Check if package exists (without jq dependency)
echo "🔍 Checking if package exists..."
PACKAGE_EXISTS=$(curl -s -H "Authorization: token ${{ secrets.TOKEN }}" \
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}" \
| jq -r '.name // "not_found"')
RESPONSE=$(curl -s -w "%{http_code}" -H "Authorization: token ${{ secrets.TOKEN }}" \
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}")
if [ "$PACKAGE_EXISTS" != "not_found" ]; then
echo "✅ Package found: $PACKAGE_EXISTS"
HTTP_CODE="${RESPONSE: -3}"
RESPONSE_BODY="${RESPONSE%???}"
echo "API Response Code: $HTTP_CODE"
if [ "$HTTP_CODE" = "200" ]; then
echo "✅ Package found!"
echo "Response: $RESPONSE_BODY"
# Try to link package to repository using the correct API
echo "🔗 Linking package to repository..."
# Try different API endpoints to link the package
echo "🔗 Attempting to link package to repository..."
# Method 1: Try package repository link
echo "Trying method 1..."
curl -X PUT \
-H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"repository_id\": \"${{ gitea.repository_id }}\"}" \
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}/repository" \
-w "\nHTTP Status: %{http_code}\n" || echo "⚠️ API linking failed"
-d '{"repository": "${{ gitea.repository }}"}' \
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}" \
-w "HTTP Status: %{http_code}\n" || echo "Method 1 failed"
echo "✅ Package linking completed"
# Method 2: Try package settings
echo "Trying method 2..."
curl -X PATCH \
-H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Content-Type: application/json" \
-d '{"repository": "${{ gitea.repository }}"}' \
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}" \
-w "HTTP Status: %{http_code}\n" || echo "Method 2 failed"
echo "✅ Package linking attempts completed"
else
echo "❌ Package not found yet - it may take a few minutes to appear"
echo "💡 The package should automatically link due to the Docker labels"
echo "❌ Package not found (HTTP $HTTP_CODE)"
echo "💡 Package should automatically link due to Docker labels"
echo "🔍 Check manually at: https://${{ env.REGISTRY }}/${{ gitea.repository_owner }}/packages"
fi
- name: Link package to repository