Skip to content

Commit c2c8651

Browse files
committed
Merge develop for v1.0.1 release
# Conflicts: # src/version.ts
2 parents 26fd009 + 8c63695 commit c2c8651

9 files changed

Lines changed: 282 additions & 28 deletions

File tree

.github/workflows/deploy-dev.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ jobs:
6060
steps:
6161
- name: Checkout code
6262
uses: actions/checkout@v4
63+
with:
64+
fetch-depth: 0
65+
fetch-tags: true
6366

6467
- name: Set up Docker Buildx
6568
uses: docker/setup-buildx-action@v3
@@ -71,6 +74,25 @@ jobs:
7174
username: ${{ secrets.REGISTRY_USERNAME }}
7275
password: ${{ secrets.REGISTRY_PASSWORD }}
7376

77+
- name: Calculate commits ahead of latest tag
78+
id: commits
79+
run: |
80+
# Get the latest tag by date (works even if tag is on different branch)
81+
LATEST_TAG=$(git tag --sort=-creatordate | head -1)
82+
if [ -n "$LATEST_TAG" ]; then
83+
# Find merge base between tag and HEAD, then count commits since
84+
MERGE_BASE=$(git merge-base $LATEST_TAG HEAD 2>/dev/null || echo "")
85+
if [ -n "$MERGE_BASE" ]; then
86+
COMMITS_AHEAD=$(git rev-list ${MERGE_BASE}..HEAD --count)
87+
else
88+
COMMITS_AHEAD=0
89+
fi
90+
else
91+
COMMITS_AHEAD=0
92+
fi
93+
echo "ahead=$COMMITS_AHEAD" >> $GITHUB_OUTPUT
94+
echo "Latest tag: $LATEST_TAG, Merge base: $MERGE_BASE, Commits ahead: $COMMITS_AHEAD"
95+
7496
- name: Build and push Docker image
7597
uses: docker/build-push-action@v6
7698
with:
@@ -80,6 +102,11 @@ jobs:
80102
tags: |
81103
${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
82104
${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
105+
build-args: |
106+
GIT_COMMIT=${{ github.sha }}
107+
GIT_REF=${{ github.ref_name }}
108+
BUILD_TIME=${{ github.event.head_commit.timestamp }}
109+
COMMITS_AHEAD=${{ steps.commits.outputs.ahead }}
83110
cache-from: type=gha
84111
cache-to: type=gha,mode=max
85112

.github/workflows/deploy-prod.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959
steps:
6060
- name: Checkout code
6161
uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
token: ${{ secrets.GITHUB_TOKEN }}
6265

6366
- name: Set up Docker Buildx
6467
uses: docker/setup-buildx-action@v3
@@ -94,6 +97,10 @@ jobs:
9497
${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
9598
${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
9699
${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:production
100+
build-args: |
101+
GIT_COMMIT=${{ github.sha }}
102+
GIT_REF=${{ github.ref_name }}
103+
BUILD_TIME=${{ github.event.head_commit.timestamp }}
97104
cache-from: type=gha
98105
cache-to: type=gha,mode=max
99106

@@ -129,11 +136,14 @@ jobs:
129136
# Update docker-compose to use production tag
130137
sed -i 's/:latest/:production/g' docker-compose.yml
131138
139+
# Set production network name (apps3 uses deployment_proxy)
140+
export PROXY_NETWORK=deployment_proxy
141+
132142
# Stop and remove old container
133-
sudo docker compose down --remove-orphans || true
143+
sudo PROXY_NETWORK=$PROXY_NETWORK docker compose down --remove-orphans || true
134144
135145
# Start new container
136-
sudo docker compose up -d
146+
sudo PROXY_NETWORK=$PROXY_NETWORK docker compose up -d
137147
138148
# Wait for service to be healthy
139149
echo "Waiting for service to be healthy..."
@@ -175,3 +185,13 @@ jobs:
175185
echo "| **Version** | ${{ steps.version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
176186
echo "| **Commit** | ${{ github.sha }} |" >> $GITHUB_STEP_SUMMARY
177187
echo "| **Triggered by** | ${{ github.actor }} |" >> $GITHUB_STEP_SUMMARY
188+
189+
- name: Sync develop branch with main
190+
run: |
191+
git config user.name "github-actions[bot]"
192+
git config user.email "github-actions[bot]@users.noreply.github.com"
193+
git fetch origin develop
194+
git checkout develop
195+
git merge main --no-edit -m "chore: sync develop with main after ${{ steps.version.outputs.version }} release"
196+
git push origin develop
197+
echo "✅ Develop branch synced with main" >> $GITHUB_STEP_SUMMARY

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111

1212
FROM node:20-alpine AS builder
1313

14+
# Build arguments for version info
15+
ARG GIT_COMMIT=unknown
16+
ARG GIT_REF=unknown
17+
ARG BUILD_TIME=unknown
18+
ARG COMMITS_AHEAD=0
19+
1420
WORKDIR /app
1521

1622
# Copy package files
@@ -22,6 +28,9 @@ RUN npm ci
2228
# Copy source
2329
COPY . .
2430

31+
# Generate version info file
32+
RUN echo "{\"commit\":\"${GIT_COMMIT}\",\"ref\":\"${GIT_REF}\",\"buildTime\":\"${BUILD_TIME}\",\"commitsAhead\":${COMMITS_AHEAD}}" > version.json
33+
2534
# Build TypeScript
2635
RUN npm run build
2736

@@ -36,9 +45,10 @@ COPY package*.json ./
3645
# Install production dependencies only
3746
RUN npm ci --omit=dev && npm cache clean --force
3847

39-
# Copy built files
48+
# Copy built files and version info
4049
COPY --from=builder /app/dist ./dist
4150
COPY --from=builder /app/bin ./bin
51+
COPY --from=builder /app/version.json ./version.json
4252

4353
# Set environment variables
4454
ENV NODE_ENV=production

deployment/docker-compose.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Digital Samba MCP Server - Development Deployment
1+
# Digital Samba MCP Server - Deployment
22
#
33
# This is the production-ready docker-compose for deployment.
44
# Images are pulled from the private registry.
@@ -9,6 +9,11 @@
99
# Requires:
1010
# - .env file with configuration
1111
# - nginx-proxy network (external)
12+
#
13+
# Environment Variables:
14+
# - PROXY_NETWORK: External network name (default: proxy)
15+
# - Dev (apps4): proxy
16+
# - Prod (apps3): deployment_proxy
1217

1318
services:
1419
mcp-server:
@@ -63,6 +68,7 @@ volumes:
6368

6469
networks:
6570
proxy:
71+
name: ${PROXY_NETWORK:-proxy}
6672
external: true
6773
internal:
6874
driver: bridge

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@digitalsamba/embedded-api-mcp-server",
3-
"version": "1.0.0-rc.1",
3+
"version": "1.0.1",
44
"packageManager": "npm@10.2.0",
55
"description": "Digital Samba Embedded API MCP Server - Model Context Protocol server for Digital Samba's Embedded API",
66
"type": "module",

scripts/inject-version.js

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
/**
44
* Inject version information into the build
55
* This script generates a version file that can be imported at runtime
6+
*
7+
* In Docker builds, version.json is generated with git info.
8+
* This script reads that file and generates the appropriate exports.
69
*/
710

811
import fs from 'fs';
@@ -16,25 +19,73 @@ const __dirname = path.dirname(__filename);
1619
const packagePath = path.join(__dirname, '..', 'package.json');
1720
const packageData = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
1821

22+
// Try to read version.json (generated during Docker build)
23+
let gitInfo = { commit: 'dev', ref: 'local', buildTime: new Date().toISOString(), commitsAhead: 0 };
24+
const versionJsonPath = path.join(__dirname, '..', 'version.json');
25+
if (fs.existsSync(versionJsonPath)) {
26+
try {
27+
gitInfo = JSON.parse(fs.readFileSync(versionJsonPath, 'utf8'));
28+
} catch {
29+
// Ignore errors, use defaults
30+
}
31+
}
32+
1933
// Create version info object
2034
const versionInfo = {
2135
version: packageData.version,
2236
name: packageData.name,
23-
buildTime: new Date().toISOString(),
37+
commit: gitInfo.commit,
38+
ref: gitInfo.ref,
39+
buildTime: gitInfo.buildTime,
40+
commitsAhead: gitInfo.commitsAhead || 0,
2441
nodeVersion: process.version
2542
};
2643

27-
// Generate version file content
44+
// Generate version file content with all exports
2845
const versionFileContent = `/**
2946
* Auto-generated version information
3047
* DO NOT EDIT - This file is automatically generated during build
3148
*/
3249
3350
export const VERSION_INFO = ${JSON.stringify(versionInfo, null, 2)};
3451
35-
export const VERSION = '${packageData.version}';
36-
export const PACKAGE_NAME = '${packageData.name}';
52+
export const VERSION = '${versionInfo.version}';
53+
export const PACKAGE_NAME = '${versionInfo.name}';
3754
export const BUILD_TIME = '${versionInfo.buildTime}';
55+
export const GIT_COMMIT = '${versionInfo.commit}';
56+
export const GIT_REF = '${versionInfo.ref}';
57+
export const COMMITS_AHEAD = ${versionInfo.commitsAhead};
58+
59+
/**
60+
* Get a formatted version string for display
61+
* Examples:
62+
* - Production (on tag): "1.0.0"
63+
* - Development: "1.0.0-rc.1 (e5f1b19)"
64+
*/
65+
export function getDisplayVersion() {
66+
// If ref is a tag or commit is dev/unknown, just show version
67+
if (
68+
GIT_REF.startsWith('v') ||
69+
GIT_COMMIT === 'dev' ||
70+
GIT_COMMIT === 'unknown'
71+
) {
72+
return VERSION;
73+
}
74+
// Otherwise show version with commit
75+
return \`\${VERSION} (\${GIT_COMMIT.substring(0, 7)})\`;
76+
}
77+
78+
/**
79+
* Check if this is a development build
80+
*/
81+
export function isDevBuild() {
82+
return (
83+
BUILD_TIME === 'development' ||
84+
GIT_REF === 'develop' ||
85+
GIT_REF.includes('dev') ||
86+
GIT_REF === 'local'
87+
);
88+
}
3889
`;
3990

4091
// Ensure dist/src directory exists
@@ -55,19 +106,29 @@ const versionDtsContent = `/**
55106
export interface VersionInfo {
56107
version: string;
57108
name: string;
109+
commit: string;
110+
ref: string;
58111
buildTime: string;
112+
commitsAhead: number;
59113
nodeVersion: string;
60114
}
61115
62116
export declare const VERSION_INFO: VersionInfo;
63117
export declare const VERSION: string;
64118
export declare const PACKAGE_NAME: string;
65119
export declare const BUILD_TIME: string;
120+
export declare const GIT_COMMIT: string;
121+
export declare const GIT_REF: string;
122+
export declare const COMMITS_AHEAD: number;
123+
export declare function getDisplayVersion(): string;
124+
export declare function isDevBuild(): boolean;
66125
`;
67126

68127
const versionDtsPath = path.join(distSrcPath, 'version.d.ts');
69128
fs.writeFileSync(versionDtsPath, versionDtsContent);
70129

71130
console.log(`✅ Version ${packageData.version} injected into build`);
72131
console.log(` - Version file: ${versionFilePath}`);
73-
console.log(` - Build time: ${versionInfo.buildTime}`);
132+
console.log(` - Build time: ${versionInfo.buildTime}`);
133+
console.log(` - Git commit: ${versionInfo.commit}`);
134+
console.log(` - Git ref: ${versionInfo.ref}`);

src/server.ts

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,15 @@ import {
9090
executeExportTool,
9191
} from "./tools/export-tools/index.js";
9292

93-
import { VERSION, VERSION_INFO } from "./version.js";
93+
import {
94+
VERSION,
95+
VERSION_INFO,
96+
GIT_COMMIT,
97+
GIT_REF,
98+
COMMITS_AHEAD,
99+
getDisplayVersion,
100+
isDevBuild,
101+
} from "./version.js";
94102

95103
// API client instance cache - keyed by apiKey:apiUrl to support different URLs per session
96104
let apiClientCache: Map<string, DigitalSambaApiClient> = new Map();
@@ -290,13 +298,18 @@ export function createServer(config: ServerConfig = {}): Server {
290298
name === "hard-delete-session-resources" ||
291299
name === "bulk-delete-session-data" ||
292300
name === "get-session-statistics" ||
301+
name === "get-session-statistics-details" ||
293302
name === "list-sessions" ||
294303
name === "get-session-details" ||
295304
name === "list-session-participants" ||
296305
name === "list-room-sessions"
297306
) {
298307
return await executeSessionTool(name, args || {}, client, request);
299308
}
309+
// Export tools (check BEFORE recording tools - export-recording-metadata contains "recording")
310+
else if (name.includes("export-")) {
311+
return await executeExportTool(name, args || {}, request, { apiUrl });
312+
}
300313
// Recording management tools
301314
else if (
302315
name.includes("recording") ||
@@ -315,16 +328,14 @@ export function createServer(config: ServerConfig = {}): Server {
315328
) {
316329
return await executeLiveSessionTool(name, args || {}, client);
317330
}
318-
// Export tools
319-
else if (name.includes("export-")) {
320-
return await executeExportTool(name, args || {}, request, { apiUrl });
321-
}
322331
// Communication management tools
323332
else if (
324333
name.includes("-chats") ||
325334
name.includes("-qa") ||
326335
name.includes("-transcripts") ||
327-
name.includes("-summaries")
336+
name.includes("-summaries") ||
337+
name === "delete-session-recordings" ||
338+
name === "delete-session-resources"
328339
) {
329340
return await executeCommunicationTool(name, args || {}, client);
330341
}
@@ -379,4 +390,12 @@ export function createServer(config: ServerConfig = {}): Server {
379390
return server;
380391
}
381392

382-
export { VERSION, VERSION_INFO };
393+
export {
394+
VERSION,
395+
VERSION_INFO,
396+
GIT_COMMIT,
397+
GIT_REF,
398+
COMMITS_AHEAD,
399+
getDisplayVersion,
400+
isDevBuild,
401+
};

0 commit comments

Comments
 (0)