Issue #10: Deployment & CI/CD
Epic: #1
Phase: 5 - Polish
Estimated Time: 2-3 days
Priority: Medium
Depends On: #2, #3, #9
Goal
Automated build, release, and deployment workflows for the Claude Code Mattermost plugin, including distribution via Mattermost Plugin Marketplace.
Tasks
1. GitHub Actions - Build Workflow
.github/workflows/build.yml:
name: Build Plugin
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '22'
- name: Build plugin
run: make build
- name: Create bundle
run: make bundle
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: plugin-bundle
path: dist/com.appsome.claudecode.tar.gz
2. GitHub Actions - Release Workflow
.github/workflows/release.yml:
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '22'
- name: Build for all platforms
run: make build-all
- name: Create bundles
run: make bundle-all
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/com.appsome.claudecode-linux-amd64.tar.gz
dist/com.appsome.claudecode-darwin-amd64.tar.gz
dist/com.appsome.claudecode-windows-amd64.tar.gz
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3. Multi-Platform Builds
Makefile targets:
.PHONY: build-all
build-all:
@echo "Building for all platforms..."
GOOS=linux GOARCH=amd64 go build -o server/dist/plugin-linux-amd64 ./server
GOOS=darwin GOARCH=amd64 go build -o server/dist/plugin-darwin-amd64 ./server
GOOS=windows GOARCH=amd64 go build -o server/dist/plugin-windows-amd64.exe ./server
cd webapp && npm run build
.PHONY: bundle-all
bundle-all: build-all
@echo "Creating platform-specific bundles..."
mkdir -p dist
tar -czf dist/com.appsome.claudecode-linux-amd64.tar.gz plugin.json server/dist/plugin-linux-amd64 webapp/dist
tar -czf dist/com.appsome.claudecode-darwin-amd64.tar.gz plugin.json server/dist/plugin-darwin-amd64 webapp/dist
tar -czf dist/com.appsome.claudecode-windows-amd64.tar.gz plugin.json server/dist/plugin-windows-amd64.exe webapp/dist
4. Semantic Versioning
Version Management:
- Use semver (MAJOR.MINOR.PATCH)
- Automate version bumping
- Update
plugin.json version on release
.github/workflows/version-bump.yml:
name: Version Bump
on:
workflow_dispatch:
inputs:
version:
description: 'Version type (major, minor, patch)'
required: true
default: 'patch'
jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump version
run: |
current=$(jq -r '.version' plugin.json)
new=$(npx semver $current -i ${{ github.event.inputs.version }})
jq ".version = \"$new\"" plugin.json > tmp.json
mv tmp.json plugin.json
- name: Commit and tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add plugin.json
git commit -m "chore: bump version to $(jq -r '.version' plugin.json)"
git tag -a "v$(jq -r '.version' plugin.json)" -m "Release v$(jq -r '.version' plugin.json)"
git push origin main --tags
5. Plugin Marketplace Submission
Marketplace Listing (marketplace.yaml):
name: Claude Code
description: Integrate Claude Code AI assistant directly in Mattermost
homepage_url: https://github.com/appsome/claude-code-mattermost-plugin
icon_path: assets/icon.png
release_notes_url: https://github.com/appsome/claude-code-mattermost-plugin/releases
support_url: https://github.com/appsome/claude-code-mattermost-plugin/issues
maintainer_name: Appsome
maintainer_url: https://github.com/appsome
labels:
- ai
- development
- code
Submission Process:
- Create plugin marketplace PR
- Include plugin.yaml, icon, screenshots
- Pass Mattermost review
- Get published
6. Bridge Server Deployment
Docker Image:
# bridge-server/Dockerfile
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY dist ./dist
EXPOSE 3002
CMD ["node", "dist/index.js"]
Docker Compose (for production):
# docker-compose.prod.yml
version: '3.8'
services:
bridge-server:
build:
context: ./bridge-server
dockerfile: Dockerfile
ports:
- "3002:3002"
environment:
- NODE_ENV=production
- DATABASE_PATH=/data/sessions.db
- CLAUDE_CODE_PATH=/usr/local/bin/claude-code
volumes:
- bridge-data:/data
restart: unless-stopped
volumes:
bridge-data:
7. Installation Documentation
docs/INSTALLATION.md:
# Installation Guide
## Prerequisites
- Mattermost Server 9.0+
- Claude Code CLI installed
- (Optional) Bridge server for multi-user setups
## Method 1: Mattermost Marketplace (Recommended)
1. Log in to Mattermost as System Admin
2. Go to **System Console** → **Plugins** → **Marketplace**
3. Search for "Claude Code"
4. Click **Install**
5. Configure settings (see Configuration section)
6. Enable the plugin
## Method 2: Manual Installation
### Download Latest Release
```bash
wget https://github.com/appsome/claude-code-mattermost-plugin/releases/latest/download/com.appsome.claudecode.tar.gz
Upload Plugin
- System Console → Plugins → Management
- Click Upload Plugin
- Select the
.tar.gz file
- Click Upload
- Enable the plugin
Configure Plugin
- System Console → Plugins → Claude Code
- Set Bridge Server URL (default:
http://localhost:3002)
- Set Claude Code CLI Path (default:
/usr/local/bin/claude-code)
- Click Save
Bridge Server Setup (Optional)
For multi-user deployments:
git clone https://github.com/appsome/claude-code-mattermost-plugin
cd bridge-server
npm install
npm run build
npm start
Or use Docker:
docker-compose -f docker-compose.prod.yml up -d
Verification
- Open any Mattermost channel
- Type
/claude-help
- You should see the help message
### 8. Update Mechanism
**Auto-update Support:**
- Plugin updates via Marketplace
- Bridge server update script
```bash
#!/bin/bash
# scripts/update-bridge.sh
cd bridge-server
git pull origin main
npm install
npm run build
pm2 restart claude-code-bridge
9. Health Checks
Bridge Server Health Endpoint:
// bridge-server/src/health.ts
app.get('/health', (req, res) => {
const health = {
status: 'ok',
version: process.env.npm_package_version,
uptime: process.uptime(),
sessions: sessionManager.getSessionCount(),
timestamp: new Date().toISOString(),
};
res.json(health);
});
Plugin Health Check:
// server/health.go
func (p *Plugin) GetHealthStatus() *model.PluginStatus {
// Check bridge server connectivity
healthy := p.bridgeClient.IsHealthy()
return &model.PluginStatus{
PluginId: manifest.Id,
Status: healthy,
}
}
10. Monitoring & Logging
Prometheus Metrics (Bridge Server):
import { register, Counter, Histogram } from 'prom-client';
const sessionCounter = new Counter({
name: 'claude_code_sessions_total',
help: 'Total number of sessions created',
});
const messageHistogram = new Histogram({
name: 'claude_code_message_duration_seconds',
help: 'Message processing time',
});
app.get('/metrics', (req, res) => {
res.set('Content-Type', register.contentType);
res.send(register.metrics());
});
Acceptance Criteria
Related Issues
References
Issue #10: Deployment & CI/CD
Epic: #1
Phase: 5 - Polish
Estimated Time: 2-3 days
Priority: Medium
Depends On: #2, #3, #9
Goal
Automated build, release, and deployment workflows for the Claude Code Mattermost plugin, including distribution via Mattermost Plugin Marketplace.
Tasks
1. GitHub Actions - Build Workflow
.github/workflows/build.yml:2. GitHub Actions - Release Workflow
.github/workflows/release.yml:3. Multi-Platform Builds
Makefile targets:
4. Semantic Versioning
Version Management:
plugin.jsonversion on release.github/workflows/version-bump.yml:5. Plugin Marketplace Submission
Marketplace Listing (
marketplace.yaml):Submission Process:
6. Bridge Server Deployment
Docker Image:
Docker Compose (for production):
7. Installation Documentation
docs/INSTALLATION.md:
Upload Plugin
.tar.gzfileConfigure Plugin
http://localhost:3002)/usr/local/bin/claude-code)Bridge Server Setup (Optional)
For multi-user deployments:
git clone https://github.com/appsome/claude-code-mattermost-plugin cd bridge-server npm install npm run build npm startOr use Docker:
Verification
/claude-help9. Health Checks
Bridge Server Health Endpoint:
Plugin Health Check:
10. Monitoring & Logging
Prometheus Metrics (Bridge Server):
Acceptance Criteria
Related Issues
References