From 25c42c728c906610251fb5e50bfe8f2e9a7c4b69 Mon Sep 17 00:00:00 2001 From: jafreli Date: Sat, 19 Jul 2025 01:32:03 +0200 Subject: [PATCH] Update worckflow --- .gitea/workflows/docker-simple.yml | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/docker-simple.yml b/.gitea/workflows/docker-simple.yml index ce197ef..09e9660 100644 --- a/.gitea/workflows/docker-simple.yml +++ b/.gitea/workflows/docker-simple.yml @@ -47,16 +47,33 @@ jobs: - name: Link Docker package to repository run: | - # Wait a moment for the package to be registered - sleep 5 + # Wait for package to be registered in Gitea + echo "⏳ Waiting for package registration..." + sleep 15 - # Link the package to the repository using Gitea API - 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 }}/link" || \ - echo "⚠️ Package linking failed, but package should still be available" + # Get package information to verify it exists + 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"') + + if [ "$PACKAGE_EXISTS" != "not_found" ]; then + echo "✅ Package found: $PACKAGE_EXISTS" + + # Try to link package to repository using the correct API + echo "🔗 Linking package to repository..." + 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" + + echo "✅ Package linking 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" + fi - name: Link package to repository run: |