From 83049192f42a5866c449230a1981c87a415a3f50 Mon Sep 17 00:00:00 2001 From: Patryk Ciechanski Date: Thu, 12 Jun 2025 12:20:36 +0200 Subject: [PATCH] fix: Remove duplicate YAML content causing syntax error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed critical YAML syntax error in build_and_publish_docker.yml where the entire workflow was duplicated starting at line 179, causing "Invalid workflow file" error. Changes: - Removed duplicate workflow definition from line 179 onwards - Preserved the corrected version with attestations: write permission - Fixed YAML structure to be valid and parseable This resolves the GitHub Actions workflow syntax validation error and ensures the Docker build process can execute properly. 🤖 Generated with Claude Code Co-Authored-By: Claude --- .../workflows/build_and_publish_docker.yml | 177 ------------------ 1 file changed, 177 deletions(-) diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml index ce033c3..fa6af44 100644 --- a/.github/workflows/build_and_publish_docker.yml +++ b/.github/workflows/build_and_publish_docker.yml @@ -116,183 +116,6 @@ jobs: 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 - - name: Update README with latest image info - if: github.ref_type == 'tag' || github.event_name == 'repository_dispatch' - run: | - # Extract the primary image tag for updating README - if [[ "${{ github.ref_type }}" == "tag" ]]; then - # For tag releases, use the version tag - LATEST_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}" - UPDATE_TYPE="release" - else - # For repository_dispatch (PR builds), use the PR tag - LATEST_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.client_payload.pr_number }}" - UPDATE_TYPE="development" - fi - - echo "Updating README.md with latest Docker image: $LATEST_TAG" - - # Update README.md with the latest image tag - sed -i.bak "s|ghcr\.io/${{ github.repository_owner }}/gemini-mcp-server:[a-zA-Z0-9\._-]*|$LATEST_TAG|g" README.md - - # Also update docs/user-guides/installation.md - sed -i.bak "s|ghcr\.io/${{ github.repository_owner }}/gemini-mcp-server:[a-zA-Z0-9\._-]*|$LATEST_TAG|g" docs/user-guides/installation.md - - # Also update docs/user-guides/configuration.md - sed -i.bak "s|ghcr\.io/${{ github.repository_owner }}/gemini-mcp-server:[a-zA-Z0-9\._-]*|$LATEST_TAG|g" docs/user-guides/configuration.md - - # Check if there are any changes - if git diff --quiet README.md docs/user-guides/installation.md docs/user-guides/configuration.md; then - echo "No changes needed in documentation" - else - echo "Documentation updated with new image tag" - - # Configure git for automated commit - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - # Add and commit changes - git add README.md docs/user-guides/installation.md docs/user-guides/configuration.md - - if [[ "$UPDATE_TYPE" == "release" ]]; then - git commit -m "docs: Update Docker image references to ${{ github.ref_name }} - - Automated update after Docker image publish for release ${{ github.ref_name }}. - All documentation now references the latest stable image. - - 🤖 Automated by GitHub Actions" - else - git commit -m "docs: Update Docker image references for PR #${{ github.event.client_payload.pr_number }} - - Automated update after Docker image publish for development build. - Documentation updated to reference the latest development image. - - 🤖 Automated by GitHub Actions" - fi - - # Push changes back to the repository - git push - - echo "### 📝 Documentation Updated" >> $GITHUB_STEP_SUMMARY - echo "README.md and user guides have been automatically updated with the new Docker image tag: \`$LATEST_TAG\`" >> $GITHUB_STEP_SUMMARY - fi -name: Build and Publish Docker Image to GHCR - -on: - push: - tags: [ 'v*' ] - repository_dispatch: - types: [docker-build] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=tag - type=raw,value=latest,enable={{is_default_branch}} - type=sha,prefix=main-,enable=${{ github.event_name == 'repository_dispatch' }} - type=raw,value=pr-${{ github.event.client_payload.pr_number }},enable=${{ github.event_name == 'repository_dispatch' && github.event.client_payload.pr_number != '' }} - - - name: Build and push Docker image - id: build - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v1 - with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.build.outputs.digest }} - 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 - - name: Update README with latest image info if: github.ref_type == 'tag' || github.event_name == 'repository_dispatch' run: |