name: Release
on:
push:
tags:
- 'v*.*.*' # Triggers on version tags like v0.1.8
jobs:
release:
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for changelog
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Extract version number
id: version_number
run: echo "VERSION_NUMBER=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Verify version in package.json matches tag
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
if [ "$PACKAGE_VERSION" != "${{ steps.version_number.outputs.VERSION_NUMBER }}" ]; then
echo "Error: Version in package.json ($PACKAGE_VERSION) does not match tag (${{ steps.version_number.outputs.VERSION_NUMBER }})"
exit 1
fi
echo "✅ Version verification passed: $PACKAGE_VERSION"
- name: Install dependencies
run: npm ci
- name: Build MCP server
run: npm run build:all
- name: Create MCPB package
run: |
# Create temporary directory for packaging
mkdir -p temp-mcpb
# Create manifest.json for MCPB
cat > temp-mcpb/manifest.json << EOF
{
"name": "tessie-mcp",
"version": "${{ steps.version_number.outputs.VERSION_NUMBER }}",
"description": "Advanced Tesla MCP server with intelligent analytics and cost optimization",
"author": "Keith",
"license": "MIT",
"main": "server.js",
"mcpVersion": "2024-11-05",
"capabilities": {
"tools": true,
"resources": false,
"prompts": false
},
"categories": ["automotive", "analytics", "iot"],
"keywords": ["tesla", "tessie", "vehicle", "analytics", "charging", "efficiency"]
}
EOF
# Copy built server
cp .smithery/stdio/index.cjs temp-mcpb/server.js
# Copy essential files
cp LICENSE temp-mcpb/ 2>/dev/null || echo "No LICENSE file found"
# Create a README for the package
cat > temp-mcpb/README.md << EOF
# Tessie MCP Server ${{ steps.version.outputs.VERSION }}
Advanced Tesla analytics platform with intelligent insights, cost optimization, and predictive analytics through the Tessie API.
## Features
- 🔋 Smart charging reminders with cost optimization
- 📊 Efficiency trends analysis with weather impact
- 🛣️ Commute pattern detection with route optimization
- 💰 Comprehensive cost analysis and trip planning
- 🤖 Predictive FSD detection from driving patterns
- 🛡️ Production-ready error handling with retry logic
## Installation
1. Double-click this .mcpb file to install in your MCP client
2. Configure your Tessie API token when prompted
3. Enjoy intelligent Tesla analytics!
Get your Tessie API token from: https://tessie.com
EOF
# Create icon
cat > temp-mcpb/icon.svg << 'EOF'
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
<defs>
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#ff4444;stop-opacity:1" />
<stop offset="100%" style="stop-color:#cc0000;stop-opacity:1" />
</linearGradient>
</defs>
<rect width="64" height="64" rx="12" fill="url(#grad)"/>
<text x="32" y="42" text-anchor="middle" fill="white" font-family="Arial" font-size="28" font-weight="bold">T</text>
</svg>
EOF
# Package into MCPB (ZIP format) with version in filename
cd temp-mcpb
zip -r ../tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb ./*
cd ..
# Clean up
rm -rf temp-mcpb
# Verify package was created
ls -la tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb
- name: Extract changelog for this version
id: changelog
run: |
# Extract the changelog section for this version
VERSION_NUMBER="${{ steps.version_number.outputs.VERSION_NUMBER }}"
# Find the start and end of this version's changelog section
START_LINE=$(grep -n "## \[v$VERSION_NUMBER\]" CHANGELOG.md | cut -d: -f1)
if [ -z "$START_LINE" ]; then
echo "Warning: No changelog entry found for version $VERSION_NUMBER"
echo "CHANGELOG_CONTENT=No changelog entry found for this version." >> $GITHUB_OUTPUT
else
# Find the next version section or end of file
NEXT_LINE=$(tail -n +$((START_LINE + 1)) CHANGELOG.md | grep -n "^## \[v" | head -1 | cut -d: -f1)
if [ -z "$NEXT_LINE" ]; then
# No next version found, take till end of file
CHANGELOG_CONTENT=$(tail -n +$((START_LINE + 1)) CHANGELOG.md)
else
# Next version found, take content between versions
END_LINE=$((START_LINE + NEXT_LINE - 1))
CHANGELOG_CONTENT=$(sed -n "$((START_LINE + 1)),$((END_LINE - 1))p" CHANGELOG.md)
fi
# Save changelog content for release notes
echo "CHANGELOG_CONTENT<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.VERSION }}
release_name: "Release ${{ steps.version.outputs.VERSION }}: Tessie MCP Extension"
body: |
# Tessie MCP Extension ${{ steps.version.outputs.VERSION }}
${{ steps.changelog.outputs.CHANGELOG_CONTENT }}
## Installation Methods
### Option 1: MCPB Package (Recommended for MCP Clients)
1. Download `tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb` from the assets below
2. Double-click the file to install in your MCP client (Claude Desktop, etc.)
3. Enable the extension in your client settings
4. Configure your Tessie API token when prompted
### Option 2: Via Smithery (Universal)
```bash
npx -y @smithery/cli install @keithah/tessie-mcp
```
## Requirements
- MCP-compatible client (Claude Desktop v0.10.0+, or any MCP client)
- Tessie account with API access
- Node.js v18.0.0 or later (for local development)
---
🤖 Auto-generated release from GitHub Actions
draft: false
prerelease: false
- name: Upload MCPB Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb
asset_name: tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb
asset_content_type: application/zip
- name: Upload checksums
run: |
# Generate checksums for the MCPB file
sha256sum tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb > tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb.sha256
md5sum tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb > tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb.md5
- name: Upload SHA256 checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb.sha256
asset_name: tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb.sha256
asset_content_type: text/plain
- name: Upload MD5 checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb.md5
asset_name: tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb.md5
asset_content_type: text/plain
- name: Commit updated MCPB to repository
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb
git commit -m "Auto-update tessie-mcp-v${{ steps.version_number.outputs.VERSION_NUMBER }}.mcpb for ${{ steps.version.outputs.VERSION }} release" || echo "No changes to commit"
git push origin HEAD:main || echo "No changes to push"