Publish Docker Image #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Docker Image | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Image tag override (leave empty for default tagging)" | |
| required: false | |
| type: string | |
| jobs: | |
| publish: | |
| name: Build & Push to Docker Hub | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: helpcodeai/anythingmcp | |
| tags: | | |
| # "latest" when no custom tag is provided | |
| type=raw,value=latest,enable=${{ inputs.tag == '' }} | |
| # custom tag from workflow input | |
| type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }} | |
| # short SHA for traceability | |
| type=sha,prefix= | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Update Docker Hub description | |
| uses: peter-evans/dockerhub-description@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| repository: helpcodeai/anythingmcp | |
| short-description: "Convert any API into an MCP server in minutes. REST, SOAP, GraphQL, Database to MCP. Self-hosted gateway & middleware for AI agents." | |
| readme-filepath: ./README.md | |
| - name: Set Docker Hub categories | |
| env: | |
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| run: | | |
| TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/users/login/" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"username\":\"$DOCKERHUB_USERNAME\",\"password\":\"$DOCKERHUB_TOKEN\"}" \ | |
| | jq -r '.token') | |
| curl -s -X PATCH "https://hub.docker.com/v2/repositories/helpcodeai/anythingmcp/" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"categories": [{"slug": "api-management"}, {"slug": "integration-and-delivery"}]}' | |
| - name: Trigger Railway redeploy | |
| if: env.RAILWAY_WEBHOOK_URL != '' | |
| env: | |
| RAILWAY_WEBHOOK_URL: ${{ secrets.RAILWAY_WEBHOOK_URL }} | |
| run: curl -fsSL -X POST "$RAILWAY_WEBHOOK_URL" |