Some checks are pending
CI/CD / lint (push) Successful in 50s
CI/CD / test (push) Successful in 1m4s
CI/CD / typecheck (push) Successful in 3m0s
CI/CD / build (amd64) (push) Successful in 2m22s
CI/CD / build (arm64) (push) Successful in 1m45s
CI/CD / publish-rpm (amd64) (push) Successful in 46s
CI/CD / publish-rpm (arm64) (push) Successful in 48s
CI/CD / publish-deb (amd64) (push) Successful in 58s
CI/CD / publish-deb (arm64) (push) Successful in 58s
CI/CD / smoke (push) Has started running
- nfpm.yaml: use ${NFPM_ARCH} (Go's ExpandEnv doesn't support :-default)
- arch-helper.sh: export RPM_ARCH (x86_64/aarch64) alongside NFPM_ARCH
- build-rpm/deb.sh: build TypeScript before running tests (tests need
built @mcpctl/shared), generate Prisma client on fresh checkout
- Fix RPM filename matching to use aarch64 not arm64
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
71 lines
2.1 KiB
Bash
Executable File
71 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
cd "$PROJECT_ROOT"
|
|
|
|
# Load .env if present
|
|
if [ -f .env ]; then
|
|
set -a; source .env; set +a
|
|
fi
|
|
|
|
GITEA_URL="${GITEA_URL:-http://10.0.0.194:3012}"
|
|
GITEA_PUBLIC_URL="${GITEA_PUBLIC_URL:-https://mysources.co.uk}"
|
|
GITEA_OWNER="${GITEA_OWNER:-michal}"
|
|
GITEA_REPO="${GITEA_REPO:-mcpctl}"
|
|
|
|
if [ -z "$GITEA_TOKEN" ]; then
|
|
echo "Error: GITEA_TOKEN not set. Add it to .env or export it."
|
|
exit 1
|
|
fi
|
|
|
|
# Architecture detection (respects MCPCTL_TARGET_ARCH)
|
|
source "$SCRIPT_DIR/arch-helper.sh"
|
|
resolve_arch "${MCPCTL_TARGET_ARCH:-}"
|
|
|
|
# Find RPM matching target architecture (RPM uses x86_64/aarch64)
|
|
RPM_FILE=$(ls dist/mcpctl-*.rpm 2>/dev/null | grep -E "[._]${RPM_ARCH}[._]" | head -1)
|
|
if [ -z "$RPM_FILE" ]; then
|
|
# Fallback: try any rpm file
|
|
RPM_FILE=$(ls dist/mcpctl-*.rpm 2>/dev/null | head -1)
|
|
fi
|
|
if [ -z "$RPM_FILE" ]; then
|
|
echo "Error: No RPM found in dist/. Run scripts/build-rpm.sh first."
|
|
exit 1
|
|
fi
|
|
|
|
# Get version string as it appears in Gitea (e.g. "0.1.0-1")
|
|
RPM_VERSION=$(rpm -qp --queryformat '%{VERSION}-%{RELEASE}' "$RPM_FILE")
|
|
|
|
echo "==> Publishing $RPM_FILE (version $RPM_VERSION) to ${GITEA_URL}..."
|
|
|
|
# Check if version already exists and delete it first
|
|
EXISTING=$(curl -s -o /dev/null -w "%{http_code}" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
"${GITEA_URL}/api/v1/packages/${GITEA_OWNER}/rpm/mcpctl/${RPM_VERSION}")
|
|
|
|
if [ "$EXISTING" = "200" ]; then
|
|
echo "==> Version $RPM_VERSION already exists, replacing..."
|
|
curl -s -o /dev/null -X DELETE \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
"${GITEA_URL}/api/v1/packages/${GITEA_OWNER}/rpm/mcpctl/${RPM_VERSION}"
|
|
fi
|
|
|
|
# Upload
|
|
curl --fail -s -X PUT \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
--upload-file "$RPM_FILE" \
|
|
"${GITEA_URL}/api/packages/${GITEA_OWNER}/rpm/upload"
|
|
|
|
echo ""
|
|
echo "==> Published successfully!"
|
|
|
|
# Ensure package is linked to the repository
|
|
source "$SCRIPT_DIR/link-package.sh"
|
|
link_package "rpm" "mcpctl"
|
|
|
|
echo ""
|
|
echo "Install with:"
|
|
echo " sudo dnf install mcpctl # if repo already configured"
|