feat: add RPM packaging with nfpm and Gitea registry publishing
Some checks are pending
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
CI / test (push) Waiting to run
CI / build (push) Blocked by required conditions
CI / package (push) Blocked by required conditions

Bundles the CLI into a standalone binary via bun compile, packages
as RPM with nfpm, and publishes to Gitea's built-in package registry.
Users install with: dnf config-manager --add-repo <gitea>/rpm.repo

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michal
2026-02-21 14:00:24 +00:00
parent 89b2b1b13d
commit 48fce7fe45
5 changed files with 120 additions and 1 deletions

View File

@@ -92,3 +92,51 @@ jobs:
- name: Build all packages
run: pnpm build
package:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Generate Prisma client
run: pnpm --filter @mcpctl/db exec prisma generate
- name: Build TypeScript
run: pnpm build
- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install nfpm
run: |
curl -sL -o /tmp/nfpm.tar.gz "https://github.com/goreleaser/nfpm/releases/download/v2.45.0/nfpm_2.45.0_Linux_x86_64.tar.gz"
tar xzf /tmp/nfpm.tar.gz -C /usr/local/bin nfpm
- name: Bundle standalone binary
run: bun build src/cli/src/index.ts --compile --outfile dist/mcpctl
- name: Build RPM
run: nfpm pkg --packager rpm --target dist/
- name: Publish to Gitea packages
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
RPM_FILE=$(ls dist/mcpctl-*.rpm | head -1)
curl --fail -X PUT \
-H "Authorization: token ${GITEA_TOKEN}" \
--upload-file "$RPM_FILE" \
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/rpm/upload"

12
nfpm.yaml Normal file
View File

@@ -0,0 +1,12 @@
name: mcpctl
arch: amd64
version: 0.1.0
release: "1"
maintainer: michal
description: kubectl-like CLI for managing MCP servers
license: MIT
contents:
- src: ./dist/mcpctl
dst: /usr/bin/mcpctl
file_info:
mode: 0755

View File

@@ -15,7 +15,9 @@
"clean": "pnpm -r run clean && rimraf node_modules",
"db:up": "docker compose -f deploy/docker-compose.yml up -d",
"db:down": "docker compose -f deploy/docker-compose.yml down",
"typecheck": "tsc --build"
"typecheck": "tsc --build",
"rpm:build": "bash scripts/build-rpm.sh",
"rpm:publish": "bash scripts/publish-rpm.sh"
},
"engines": {
"node": ">=20.0.0",

23
scripts/build-rpm.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_ROOT"
export VERSION="${VERSION:-0.1.0}"
echo "==> Building TypeScript..."
pnpm build
echo "==> Bundling standalone binary..."
mkdir -p dist
bun build src/cli/src/index.ts --compile --outfile dist/mcpctl
echo "==> Packaging RPM..."
nfpm pkg --packager rpm --target dist/
RPM_FILE=$(ls dist/mcpctl-*.rpm 2>/dev/null | head -1)
echo "==> Built: $RPM_FILE"
echo " Size: $(du -h "$RPM_FILE" | cut -f1)"
rpm -qpi "$RPM_FILE"

34
scripts/publish-rpm.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_ROOT"
GITEA_URL="${GITEA_URL:-http://10.0.0.194:3012}"
GITEA_OWNER="${GITEA_OWNER:-michal}"
if [ -z "$GITEA_TOKEN" ]; then
echo "Error: GITEA_TOKEN environment variable is required"
echo "Create one at: ${GITEA_URL}/user/settings/applications"
exit 1
fi
RPM_FILE=$(ls dist/mcpctl-*.rpm 2>/dev/null | head -1)
if [ -z "$RPM_FILE" ]; then
echo "Error: No RPM file found in dist/. Run scripts/build-rpm.sh first."
exit 1
fi
echo "==> Publishing $RPM_FILE to ${GITEA_URL}..."
curl --fail -X PUT \
-H "Authorization: token ${GITEA_TOKEN}" \
--upload-file "$RPM_FILE" \
"${GITEA_URL}/api/packages/${GITEA_OWNER}/rpm/upload"
echo ""
echo "==> Published successfully!"
echo ""
echo "Users can install with:"
echo " dnf config-manager --add-repo ${GITEA_URL}/api/packages/${GITEA_OWNER}/rpm.repo"
echo " dnf install mcpctl"