feat: Add automated Docker image usage instructions and PR comments

- Generate comprehensive usage instructions in workflow summary after Docker build
- Include exact docker pull commands with built image tags
- Auto-generate Claude Desktop configuration examples
- Add automatic PR comments with testing instructions for +docker builds
- Show expected image tags (pr-X, main-sha) in PR comments
- Include ready-to-use configuration snippets for immediate testing
- Link to GitHub Container Registry and Actions for monitoring

Now when Docker images are built, users get:
- Step-by-step usage instructions in workflow summary
- PR comments with exact pull commands and config
- Copy-paste ready Claude Desktop configurations
- Direct links to monitor build progress

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Patryk Ciechanski
2025-06-12 10:12:30 +02:00
parent 44a67c5895
commit 9310b68694
2 changed files with 96 additions and 1 deletions

View File

@@ -177,6 +177,47 @@ jobs:
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/dispatches" \
-d '{"event_type":"docker-build","client_payload":{"pr_number":"${{ github.event.pull_request.number }}","pr_title":"${{ github.event.pull_request.title }}","commit_sha":"${{ github.sha }}"}}'
# Add comment to PR about Docker build
COMMENT_BODY="🐳 **Docker Image Build Triggered**
This PR triggered a Docker image build because of the \`+docker\` suffix in the title.
**Expected Image Tags:**
- \`ghcr.io/${{ github.repository_owner }}/gemini-mcp-server:pr-${{ github.event.pull_request.number }}\`
- \`ghcr.io/${{ github.repository_owner }}/gemini-mcp-server:main-${{ github.sha }}\`
**To test the image after build completes:**
\`\`\`bash
docker pull ghcr.io/${{ github.repository_owner }}/gemini-mcp-server:pr-${{ github.event.pull_request.number }}
\`\`\`
**Claude Desktop config for testing:**
\`\`\`json
{
\"mcpServers\": {
\"gemini\": {
\"command\": \"docker\",
\"args\": [
\"run\", \"--rm\", \"-i\",
\"-e\", \"GEMINI_API_KEY\",
\"ghcr.io/${{ github.repository_owner }}/gemini-mcp-server:pr-${{ github.event.pull_request.number }}\"
],
\"env\": {
\"GEMINI_API_KEY\": \"your-api-key-here\"
}
}
}
}
\`\`\`
View the build progress in the [Actions tab](https://github.com/${{ github.repository }}/actions)."
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \
-d "{\"body\":\"$COMMENT_BODY\"}"
fi
- name: Summary

View File

@@ -59,4 +59,58 @@ jobs:
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
push-to-registry: true
- name: Generate usage instructions
run: |
echo "## 🐳 Docker Image Published Successfully!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Image Registry:** GitHub Container Registry (GHCR)" >> $GITHUB_STEP_SUMMARY
echo "**Built Tags:** ${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Extract the first tag for the main pull command
MAIN_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
echo "### 📥 Pull the Image" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
echo "docker pull $MAIN_TAG" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### ⚙️ Claude Desktop Configuration" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`json" >> $GITHUB_STEP_SUMMARY
echo "{" >> $GITHUB_STEP_SUMMARY
echo " \"mcpServers\": {" >> $GITHUB_STEP_SUMMARY
echo " \"gemini\": {" >> $GITHUB_STEP_SUMMARY
echo " \"command\": \"docker\"," >> $GITHUB_STEP_SUMMARY
echo " \"args\": [" >> $GITHUB_STEP_SUMMARY
echo " \"run\", \"--rm\", \"-i\"," >> $GITHUB_STEP_SUMMARY
echo " \"-e\", \"GEMINI_API_KEY\"," >> $GITHUB_STEP_SUMMARY
echo " \"$MAIN_TAG\"" >> $GITHUB_STEP_SUMMARY
echo " ]," >> $GITHUB_STEP_SUMMARY
echo " \"env\": {" >> $GITHUB_STEP_SUMMARY
echo " \"GEMINI_API_KEY\": \"your-gemini-api-key-here\"" >> $GITHUB_STEP_SUMMARY
echo " }" >> $GITHUB_STEP_SUMMARY
echo " }" >> $GITHUB_STEP_SUMMARY
echo " }" >> $GITHUB_STEP_SUMMARY
echo "}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🏷️ All Available Tags" >> $GITHUB_STEP_SUMMARY
echo "Built and pushed the following tags:" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.meta.outputs.tags }}" | sed 's/^/- `/' | sed 's/$/`/' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
echo "**Note:** This is a development build triggered by PR #${{ github.event.client_payload.pr_number }}" >> $GITHUB_STEP_SUMMARY
echo "Use this image for testing the changes from that PR." >> $GITHUB_STEP_SUMMARY
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "**Note:** This is a release build from tag ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "This image represents a stable release version." >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📦 View in GitHub Container Registry" >> $GITHUB_STEP_SUMMARY
echo "[View all versions and tags →](https://github.com/${{ github.repository }}/pkgs/container/gemini-mcp-server)" >> $GITHUB_STEP_SUMMARY