Update worckflow
All checks were successful
Build and Push Docker Image (Simple) / build-and-push (push) Successful in 19s
All checks were successful
Build and Push Docker Image (Simple) / build-and-push (push) Successful in 19s
This commit is contained in:
@@ -51,28 +51,46 @@ jobs:
|
|||||||
echo "⏳ Waiting for package registration..."
|
echo "⏳ Waiting for package registration..."
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
# Get package information to verify it exists
|
# Check if package exists (without jq dependency)
|
||||||
echo "🔍 Checking if package exists..."
|
echo "🔍 Checking if package exists..."
|
||||||
PACKAGE_EXISTS=$(curl -s -H "Authorization: token ${{ secrets.TOKEN }}" \
|
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 }}" \
|
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}")
|
||||||
| jq -r '.name // "not_found"')
|
|
||||||
|
|
||||||
if [ "$PACKAGE_EXISTS" != "not_found" ]; then
|
HTTP_CODE="${RESPONSE: -3}"
|
||||||
echo "✅ Package found: $PACKAGE_EXISTS"
|
RESPONSE_BODY="${RESPONSE%???}"
|
||||||
|
|
||||||
# Try to link package to repository using the correct API
|
echo "API Response Code: $HTTP_CODE"
|
||||||
echo "🔗 Linking package to repository..."
|
|
||||||
|
if [ "$HTTP_CODE" = "200" ]; then
|
||||||
|
echo "✅ Package found!"
|
||||||
|
echo "Response: $RESPONSE_BODY"
|
||||||
|
|
||||||
|
# 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 \
|
curl -X PUT \
|
||||||
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"repository_id\": \"${{ gitea.repository_id }}\"}" \
|
-d '{"repository": "${{ gitea.repository }}"}' \
|
||||||
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}/repository" \
|
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}" \
|
||||||
-w "\nHTTP Status: %{http_code}\n" || echo "⚠️ API linking failed"
|
-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
|
else
|
||||||
echo "❌ Package not found yet - it may take a few minutes to appear"
|
echo "❌ Package not found (HTTP $HTTP_CODE)"
|
||||||
echo "💡 The package should automatically link due to the Docker labels"
|
echo "💡 Package should automatically link due to Docker labels"
|
||||||
|
echo "🔍 Check manually at: https://${{ env.REGISTRY }}/${{ gitea.repository_owner }}/packages"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Link package to repository
|
- name: Link package to repository
|
||||||
|
|||||||
Reference in New Issue
Block a user