Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91c0aa707b | |||
| 54905bd7bb |
83
.gitea/workflows/release.yaml
Normal file
83
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Verify version matches tag
|
||||||
|
run: |
|
||||||
|
TAG="${GITHUB_REF#refs/tags/v}"
|
||||||
|
PKG_VERSION=$(node -p "require('./package.json').version")
|
||||||
|
if [ "$TAG" != "$PKG_VERSION" ]; then
|
||||||
|
echo "::error::Tag v${TAG} does not match package.json version ${PKG_VERSION}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Version match confirmed: v${TAG}"
|
||||||
|
|
||||||
|
- name: Check endpoint drift
|
||||||
|
run: npm run check-endpoint-drift
|
||||||
|
|
||||||
|
- name: Generate changelog
|
||||||
|
id: changelog
|
||||||
|
run: |
|
||||||
|
TAG="${GITHUB_REF#refs/tags/}"
|
||||||
|
PREV_TAG=$(git tag --sort=-v:refname | grep '^v' | sed -n '2p')
|
||||||
|
if [ -n "$PREV_TAG" ]; then
|
||||||
|
LOG=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..${TAG}")
|
||||||
|
echo "PREV_TAG=${PREV_TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
LOG=$(git log --pretty=format:"- %s (%h)" "${TAG}")
|
||||||
|
fi
|
||||||
|
# Write multiline output
|
||||||
|
{
|
||||||
|
echo "log<<CHANGELOG_EOF"
|
||||||
|
echo "$LOG"
|
||||||
|
echo "CHANGELOG_EOF"
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Create Gitea release
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
TAG="${GITHUB_REF#refs/tags/}"
|
||||||
|
PREV_TAG="${{ steps.changelog.outputs.PREV_TAG }}"
|
||||||
|
BODY="## Changes
|
||||||
|
|
||||||
|
${{ steps.changelog.outputs.log }}"
|
||||||
|
|
||||||
|
if [ -n "$PREV_TAG" ]; then
|
||||||
|
BODY="${BODY}
|
||||||
|
|
||||||
|
**Full Changelog**: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/compare/${PREV_TAG}...${TAG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -s -X POST "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases" \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$(jq -n \
|
||||||
|
--arg tag "$TAG" \
|
||||||
|
--arg name "$TAG" \
|
||||||
|
--arg body "$BODY" \
|
||||||
|
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}'
|
||||||
|
)"
|
||||||
38
.gitea/workflows/version-check.yaml
Normal file
38
.gitea/workflows/version-check.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Version Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'package.json'
|
||||||
|
- 'src/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Check version was bumped if source changed
|
||||||
|
run: |
|
||||||
|
BASE_SHA="${{ github.event.pull_request.base.sha }}"
|
||||||
|
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
||||||
|
|
||||||
|
# Check if any src/ files changed
|
||||||
|
SRC_CHANGED=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" -- 'src/' | wc -l)
|
||||||
|
if [ "$SRC_CHANGED" -eq 0 ]; then
|
||||||
|
echo "No source changes detected, skipping version check."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Compare package.json versions
|
||||||
|
BASE_VERSION=$(git show "${BASE_SHA}:package.json" | node -p "JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')).version")
|
||||||
|
HEAD_VERSION=$(node -p "require('./package.json').version")
|
||||||
|
|
||||||
|
if [ "$BASE_VERSION" = "$HEAD_VERSION" ]; then
|
||||||
|
echo "::warning::Source files changed but package.json version was not bumped (${HEAD_VERSION}). Consider updating the version."
|
||||||
|
else
|
||||||
|
echo "Version bumped: ${BASE_VERSION} → ${HEAD_VERSION}"
|
||||||
|
fi
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ezscale/virtfusion-mcp",
|
"name": "@ezscale/virtfusion-mcp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "Model Context Protocol (MCP) server for the VirtFusion virtualization control panel API",
|
"description": "Model Context Protocol (MCP) server for the VirtFusion virtualization control panel API",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -100,14 +100,15 @@ export function registerServerTools(server: McpServer, client: VirtFusionClient)
|
|||||||
|
|
||||||
server.tool(
|
server.tool(
|
||||||
'servers_delete',
|
'servers_delete',
|
||||||
'Delete a server',
|
'Delete a server. A minimum 5-minute (300s) delay is enforced as a safety margin.',
|
||||||
{
|
{
|
||||||
serverId: z.number().describe('The server ID'),
|
serverId: z.number().describe('The server ID'),
|
||||||
delay: z.number().optional().describe('Delay in seconds before deletion'),
|
delay: z.number().optional().describe('Delay in seconds before deletion (minimum 300)'),
|
||||||
},
|
},
|
||||||
async ({ serverId, delay }) => {
|
async ({ serverId, delay }) => {
|
||||||
try {
|
try {
|
||||||
const result = await client.delete(`/servers/${serverId}`, undefined, { delay });
|
const safeDelay = Math.max(delay ?? 300, 300);
|
||||||
|
const result = await client.delete(`/servers/${serverId}`, undefined, { delay: safeDelay });
|
||||||
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return formatErrorResponse(error);
|
return formatErrorResponse(error);
|
||||||
@@ -220,11 +221,11 @@ export function registerServerTools(server: McpServer, client: VirtFusionClient)
|
|||||||
"Throttle a server's CPU",
|
"Throttle a server's CPU",
|
||||||
{
|
{
|
||||||
serverId: z.number().describe('The server ID'),
|
serverId: z.number().describe('The server ID'),
|
||||||
cpuThrottle: z.number().describe('CPU throttle value'),
|
cpuThrottle: z.number().describe('CPU throttle percentage (0-99). 0 removes throttle.'),
|
||||||
},
|
},
|
||||||
async ({ serverId, cpuThrottle }) => {
|
async ({ serverId, cpuThrottle }) => {
|
||||||
try {
|
try {
|
||||||
const result = await client.put(`/servers/${serverId}/modify/cpuThrottle`, { cpuThrottle });
|
const result = await client.put(`/servers/${serverId}/modify/cpuThrottle`, { percent: cpuThrottle });
|
||||||
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return formatErrorResponse(error);
|
return formatErrorResponse(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user