name: Publish Docker Image
on:
workflow_run:
workflows: ["CI", "Publish Crate", "Security Audit"]
types: [ completed ]
workflow_dispatch:
inputs:
version:
description: "Release version to publish, e.g. 1.0.0"
required: true
default: "1.0.0"
type: string
permissions:
contents: read
packages: write
actions: write
jobs:
push-mcp-images:
runs-on: ubicloud-standard-2
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Normalize version
id: version
run: |
set -eux
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
RAW="${{ github.event.inputs.version }}"
else
RAW="${{ github.event.workflow_run.head_branch }}"
fi
RAW_TAG="${RAW#refs/tags/}"
VERSION="${RAW_TAG#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
rustfs/mcp:latest
rustfs/mcp:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository_owner }}/mcp:latest
ghcr.io/${{ github.repository_owner }}/mcp:${{ steps.version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ steps.version.outputs.version }}