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: |
|
run: |
|
||||||
docker push ${{ env.REGISTRY }}/${{ steps.repo.outputs.repository_lower }}/${{ steps.repo.outputs.repository_name }}:latest
|
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: |
|
run: |
|
||||||
# Wait for package to be registered in Gitea
|
echo "🔍 Debugging package registration..."
|
||||||
echo "⏳ Waiting for package registration..."
|
echo "Expected package path: ${{ steps.repo.outputs.repository_name }}"
|
||||||
sleep 15
|
echo "Full image path: ${{ env.REGISTRY }}/${{ steps.repo.outputs.repository_lower }}/${{ steps.repo.outputs.repository_name }}:latest"
|
||||||
|
|
||||||
# Check if package exists (without jq dependency)
|
# Wait for package registration
|
||||||
echo "🔍 Checking if package exists..."
|
sleep 20
|
||||||
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 }}")
|
|
||||||
|
|
||||||
HTTP_CODE="${RESPONSE: -3}"
|
# List all packages for the user to see what's actually there
|
||||||
RESPONSE_BODY="${RESPONSE%???}"
|
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
|
# Try with full repository name
|
||||||
echo "✅ Package found!"
|
echo "Checking: ${{ steps.repo.outputs.repository_lower }}"
|
||||||
echo "Response: $RESPONSE_BODY"
|
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 different API endpoints to link the package
|
|
||||||
echo "🔗 Attempting to link package to repository..."
|
# Try with just repo name
|
||||||
|
echo "Checking: ${{ steps.repo.outputs.repository_name }}"
|
||||||
# Method 1: Try package repository link
|
curl -s -w "HTTP: %{http_code}\n" -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
echo "Trying method 1..."
|
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}" || true
|
||||||
curl -X PUT \
|
|
||||||
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
echo "💡 If package exists but isn't linked, you can manually link it in the Gitea UI:"
|
||||||
-H "Content-Type: application/json" \
|
echo " 1. Go to https://${{ env.REGISTRY }}/${{ gitea.repository_owner }}/packages"
|
||||||
-d '{"repository": "${{ gitea.repository }}"}' \
|
echo " 2. Find your package"
|
||||||
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}" \
|
echo " 3. Click 'Link to Repository'"
|
||||||
-w "HTTP Status: %{http_code}\n" || echo "Method 1 failed"
|
echo " 4. Select your repository: ${{ gitea.repository }}"
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
- name: Link package to repository
|
- name: Link package to repository
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user