From 76ddff1f77c22836dcc2b6ef696d0e435adddc86 Mon Sep 17 00:00:00 2001 From: Carlos Barbero Date: Thu, 29 Jan 2026 07:32:49 -0300 Subject: [PATCH] ci: add github actions to build and publish docker image to ghcr --- .../.github/workflows/docker-publish.yml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 mcp-server/.github/workflows/docker-publish.yml diff --git a/mcp-server/.github/workflows/docker-publish.yml b/mcp-server/.github/workflows/docker-publish.yml new file mode 100644 index 00000000..5de268a0 --- /dev/null +++ b/mcp-server/.github/workflows/docker-publish.yml @@ -0,0 +1,61 @@ +name: Docker Build and Publish + +on: + push: + branches: [ "main", "feat/diagrams-mcp-server" ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + pull_request: + branches: [ "main" ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (only on push) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max