|
|
|
@@ -29,7 +29,13 @@ jobs:
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build Docker image
|
|
|
|
- name: Build Docker image
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
docker build -t ${{ env.REGISTRY }}/${{ steps.repo.outputs.repository_lower }}/${{ steps.repo.outputs.repository_name }}:latest .
|
|
|
|
docker build \
|
|
|
|
|
|
|
|
--build-arg SOURCE_URL="https://${{ env.REGISTRY }}/${{ gitea.repository }}" \
|
|
|
|
|
|
|
|
--build-arg REPO_NAME="${{ steps.repo.outputs.repository_name }}" \
|
|
|
|
|
|
|
|
--label "org.opencontainers.image.source=https://${{ env.REGISTRY }}/${{ gitea.repository }}" \
|
|
|
|
|
|
|
|
--label "org.opencontainers.image.url=https://${{ env.REGISTRY }}/${{ gitea.repository }}" \
|
|
|
|
|
|
|
|
--label "org.opencontainers.image.documentation=https://${{ env.REGISTRY }}/${{ gitea.repository }}" \
|
|
|
|
|
|
|
|
-t ${{ env.REGISTRY }}/${{ steps.repo.outputs.repository_lower }}/${{ steps.repo.outputs.repository_name }}:latest .
|
|
|
|
|
|
|
|
|
|
|
|
- name: Log in to Container Registry
|
|
|
|
- name: Log in to Container Registry
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
@@ -41,16 +47,33 @@ jobs:
|
|
|
|
|
|
|
|
|
|
|
|
- name: Link Docker package to repository
|
|
|
|
- name: Link Docker package to repository
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
# Wait a moment for the package to be registered
|
|
|
|
# Wait for package to be registered in Gitea
|
|
|
|
sleep 5
|
|
|
|
echo "⏳ Waiting for package registration..."
|
|
|
|
|
|
|
|
sleep 15
|
|
|
|
|
|
|
|
|
|
|
|
# Link the package to the repository using Gitea API
|
|
|
|
# Get package information to verify it exists
|
|
|
|
curl -X PUT \
|
|
|
|
echo "🔍 Checking if package exists..."
|
|
|
|
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
|
|
|
PACKAGE_EXISTS=$(curl -s -H "Authorization: token ${{ secrets.TOKEN }}" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
"https://${{ env.REGISTRY }}/api/v1/packages/${{ gitea.repository_owner }}/container/${{ steps.repo.outputs.repository_name }}" \
|
|
|
|
-d '{"repository_id": ${{ gitea.repository_id }}}' \
|
|
|
|
| jq -r '.name // "not_found"')
|
|
|
|
"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"
|
|
|
|
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
|
|
|
|
- name: Link package to repository
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
|