name: Publish Docker Image
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: read
packages: write
attestations: write
id-token: write
jobs:
publish:
name: Build and Push to Docker Hub
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
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.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: jasonsmithj/redash-mcp
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=jasonsmithj/redash-mcp:buildcache
cache-to: type=registry,ref=jasonsmithj/redash-mcp:buildcache,mode=max
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: index.docker.io/jasonsmithj/redash-mcp
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true