Files
gitea-mcp/.gitea/workflows/build-image.yml
T
zhengchen.tao 71600adba9
Build Docker Image / build (push) Failing after 1m40s
Initial public release
MCP (Model Context Protocol) server providing read-only access to a Gitea
instance, gated by OAuth-issued JWT bearer tokens. See README.md for setup.
2026-05-17 23:54:59 +08:00

97 lines
3.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build Docker Image
# Registry / 镜像路径通过 gitea 仓库 Variables 配置:
# vars.REGISTRY 例如 git.example.com(不带协议、不带斜杠)
# vars.IMAGE_OWNER 例如 your-username 或组织名
# secrets.PACKAGES_TOKEN 推镜像用的 token
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'LICENSE'
- '.gitignore'
- '.dockerignore'
- '.gitea/workflows/sync-upstream.yml'
workflow_dispatch:
inputs:
branch:
description: '要打包的分支(仅手动触发生效)'
required: true
default: 'main'
tag:
description: '镜像 tag(留空则用 commit short hash'
required: false
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout target branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || github.ref_name }}
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# 钉 v0.13.2runc 1.1.x,兼容老内核(不支持 openat2/fsmount 的 host
driver-opts: |
image=moby/buildkit:v0.13.2
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGES_TOKEN }}
- name: Determine image tag
id: meta
run: |
if [ -n "${{ inputs.tag }}" ]; then
IMAGE_TAG="${{ inputs.tag }}"
else
IMAGE_TAG="$(git rev-parse --short HEAD)"
fi
IMAGE_REF="${{ vars.REGISTRY }}/${{ vars.IMAGE_OWNER }}/gitea-mcp"
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "image_ref=$IMAGE_REF" >> $GITHUB_OUTPUT
echo "full_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "==> Image: $IMAGE_REF:$IMAGE_TAG"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
cache-from: type=registry,ref=${{ steps.meta.outputs.image_ref }}:buildcache
cache-to: type=registry,ref=${{ steps.meta.outputs.image_ref }}:buildcache,mode=min,ignore-error=true
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ steps.meta.outputs.full_sha }}
tags: |
${{ steps.meta.outputs.image_ref }}:${{ steps.meta.outputs.image_tag }}
${{ steps.meta.outputs.image_ref }}:latest
- name: Build summary
if: always()
run: |
{
echo "## Build Summary"
echo ""
echo "| 项 | 值 |"
echo "|---|---|"
echo "| 触发方式 | \`${{ github.event_name }}\` |"
echo "| 源分支 | \`${{ github.ref_name }}\` |"
echo "| Commit (full) | \`${{ steps.meta.outputs.full_sha }}\` |"
echo "| 镜像 | \`${{ steps.meta.outputs.image_ref }}:${{ steps.meta.outputs.image_tag }}\` + \`:latest\` |"
} >> "$GITHUB_STEP_SUMMARY"