Update worckflow
All checks were successful
Build and Push Docker Image (Simple) / build-and-push (push) Successful in 25s
All checks were successful
Build and Push Docker Image (Simple) / build-and-push (push) Successful in 25s
This commit is contained in:
@@ -45,53 +45,38 @@ jobs:
|
||||
run: |
|
||||
docker push ${{ env.REGISTRY }}/${{ steps.repo.outputs.repository_lower }}/${{ steps.repo.outputs.repository_name }}:latest
|
||||
|
||||
- name: Link Docker package to repository
|
||||
- name: Debug and link package
|
||||
run: |
|
||||
# Wait for package to be registered in Gitea
|
||||
echo "⏳ Waiting for package registration..."
|
||||
sleep 15
|
||||
echo "🔍 Debugging package registration..."
|
||||
echo "Expected package path: ${{ steps.repo.outputs.repository_name }}"
|
||||
echo "Full image path: ${{ env.REGISTRY }}/${{ steps.repo.outputs.repository_lower }}/${{ steps.repo.outputs.repository_name }}:latest"
|
||||
|
||||
# Check if package exists (without jq dependency)
|
||||
echo "🔍 Checking if package exists..."
|
||||
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 }}")
|
||||
# Wait for package registration
|
||||
sleep 20
|
||||
|
||||
HTTP_CODE="${RESPONSE: -3}"
|
||||
RESPONSE_BODY="${RESPONSE%???}"
|
||||
# List all packages for the user to see what's actually there
|
||||
echo "📦 Listing all packages for user ${{ gitea.repository_owner }}:"
|
||||
curl -s -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}" || echo "Failed to list packages"
|
||||
|
||||
echo "API Response Code: $HTTP_CODE"
|
||||
# Try to find the package with different names
|
||||
echo "🔍 Trying different package names..."
|
||||
|
||||
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 \
|
||||
-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 1 failed"
|
||||
|
||||
# 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 (HTTP $HTTP_CODE)"
|
||||
echo "💡 Package should automatically link due to Docker labels"
|
||||
echo "🔍 Check manually at: https://${{ env.REGISTRY }}/${{ gitea.repository_owner }}/packages"
|
||||
fi
|
||||
# Try with full repository name
|
||||
echo "Checking: ${{ steps.repo.outputs.repository_lower }}"
|
||||
curl -s -w "HTTP: %{http_code}\n" -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_lower }}" || true
|
||||
|
||||
# Try with just repo name
|
||||
echo "Checking: ${{ steps.repo.outputs.repository_name }}"
|
||||
curl -s -w "HTTP: %{http_code}\n" -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}" || true
|
||||
|
||||
echo "💡 If package exists but isn't linked, you can manually link it in the Gitea UI:"
|
||||
echo " 1. Go to https://${{ env.REGISTRY }}/${{ gitea.repository_owner }}/packages"
|
||||
echo " 2. Find your package"
|
||||
echo " 3. Click 'Link to Repository'"
|
||||
echo " 4. Select your repository: ${{ gitea.repository }}"
|
||||
|
||||
- name: Link package to repository
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user