fix: Enable automatic Docker workflow triggering with PAT token

- Replace GITHUB_TOKEN with PAT in auto-version workflow to allow triggering subsequent workflows
- Improve Docker workflow README update logic to handle repository_dispatch events properly
- Add support for manual Docker builds with latest tag updates
- Fix condition logic for when to update README.md documentation

This resolves the issue where fix: prefixed PRs created tags but didn't trigger Docker builds,
ensuring complete automation flow from PR merge → version bump → Docker build → README update.

🤖 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 12:45:27 +02:00
parent e3b853efb2
commit 7f3de5fc5b
2 changed files with 15 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.PAT }}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4

View File

@@ -117,17 +117,21 @@ jobs:
echo "[View all versions and tags →](https://github.com/${{ github.repository }}/pkgs/container/gemini-mcp-server)" >> $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 - name: Update README with latest image info
if: github.ref_type == 'tag' || github.event_name == 'repository_dispatch' if: github.ref_type == 'tag' || (github.event_name == 'repository_dispatch' && github.event.client_payload.pr_number != '')
run: | run: |
# Extract the primary image tag for updating README # Extract the primary image tag for updating README
if [[ "${{ github.ref_type }}" == "tag" ]]; then if [[ "${{ github.ref_type }}" == "tag" ]]; then
# For tag releases, use the version tag # For tag releases, use the version tag
LATEST_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}" LATEST_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}"
UPDATE_TYPE="release" UPDATE_TYPE="release"
else elif [[ "${{ github.event_name }}" == "repository_dispatch" && "${{ github.event.client_payload.pr_number }}" != "" ]]; then
# For repository_dispatch (PR builds), use the PR tag # For repository_dispatch (PR builds), use the PR tag
LATEST_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.client_payload.pr_number }}" LATEST_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.client_payload.pr_number }}"
UPDATE_TYPE="development" UPDATE_TYPE="development"
else
# For manual repository_dispatch without PR number, use latest tag
LATEST_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
UPDATE_TYPE="manual"
fi fi
echo "Updating README.md with latest Docker image: $LATEST_TAG" echo "Updating README.md with latest Docker image: $LATEST_TAG"
@@ -161,12 +165,19 @@ jobs:
All documentation now references the latest stable image. All documentation now references the latest stable image.
🤖 Automated by GitHub Actions" 🤖 Automated by GitHub Actions"
else elif [[ "$UPDATE_TYPE" == "development" ]]; then
git commit -m "docs: Update Docker image references for PR #${{ github.event.client_payload.pr_number }} 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. Automated update after Docker image publish for development build.
Documentation updated to reference the latest development image. Documentation updated to reference the latest development image.
🤖 Automated by GitHub Actions"
else
git commit -m "docs: Update Docker image references to latest
Automated update after manual Docker image build.
Documentation updated to reference the latest image.
🤖 Automated by GitHub Actions" 🤖 Automated by GitHub Actions"
fi fi