77 lines
2.5 KiB
YAML
77 lines
2.5 KiB
YAML
name: Release to GitHub Packages
|
|
description: Release to GitHub Packages
|
|
|
|
inputs:
|
|
arm64_binary:
|
|
description: Directory for linux arm64 binary
|
|
required: true
|
|
amd64_binary:
|
|
description: Directory for linux amd64 binary
|
|
required: true
|
|
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
sparse-checkout: |
|
|
Dockerfile
|
|
server.json
|
|
sparse-checkout-cone-mode: false
|
|
- id: check-latest
|
|
shell: bash
|
|
run: |
|
|
if [[ "${GITHUB_REF}" =~ ^refs/tags/[^/]+$ && ! "${GITHUB_REF}" =~ -(rc|beta|alpha|dev)$ ]]; then
|
|
echo "is_latest=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "is_latest=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
- uses: actions/download-artifact@v7
|
|
with:
|
|
name: binary
|
|
path: ${{ github.workspace }}/dist
|
|
- uses: docker/setup-qemu-action@v3
|
|
- uses: docker/setup-buildx-action@v3
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ github.token }}
|
|
- id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
flavor: |
|
|
latest=${{ steps.check-latest.outputs.is_latest }}
|
|
labels: |
|
|
io.modelcontextprotocol.server.name=io.github.eat-pray-ai/yutu
|
|
- id: push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
target: yutu
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
annotations: ${{ steps.meta.outputs.annotations }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|
|
provenance: true
|
|
sbom: true
|
|
build-args: |
|
|
arm64_binary=${{ inputs.amd64_binary }}
|
|
amd64_binary=${{ inputs.amd64_binary }}
|
|
- uses: actions/attest-build-provenance@v3
|
|
with:
|
|
subject-name: ghcr.io/${{ github.repository }}
|
|
subject-digest: ${{ steps.push.outputs.digest }}
|
|
push-to-registry: true
|
|
- name: Publish MCP server
|
|
shell: bash
|
|
run: |
|
|
sed -i "s/0.0.0-dev/${GITHUB_REF_NAME}/g" server.json
|
|
mcp_publisher="mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz"
|
|
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/${mcp_publisher}" | tar xz mcp-publisher
|
|
./mcp-publisher login github-oidc
|
|
./mcp-publisher publish || echo "Failed to publish MCP server, but the image has been pushed successfully"
|