Skip to content

Commit 629751d

Browse files
committed
feat: add GitHub Actions workflows for CI/CD and npm publishing
- Add comprehensive CI workflow with multi-Node.js version testing - Add automated npm publishing workflow triggered by releases - Add release creation workflow with proper tagging and release notes - Include security auditing and build verification steps - Configure proper npm authentication and package verification These workflows enable: - Automated testing on push/PR (Node.js 18, 20, 22) - Automated npm publishing on GitHub releases - Comprehensive build and security validation - Proper semantic versioning and release management
1 parent 37509b6 commit 629751d

File tree

3 files changed

+413
-0
lines changed

3 files changed

+413
-0
lines changed

.github/workflows/ci.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
name: Test on Node.js ${{ matrix.node-version }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [18, 20, 22]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run linting (if available)
31+
run: |
32+
if npm run lint --silent 2>/dev/null; then
33+
npm run lint
34+
else
35+
echo "No linting script found, skipping..."
36+
fi
37+
continue-on-error: true
38+
39+
- name: Run tests
40+
run: npm test
41+
42+
- name: Run test coverage
43+
run: npm run test:coverage
44+
if: matrix.node-version == 18
45+
46+
- name: Upload coverage to Codecov
47+
uses: codecov/codecov-action@v4
48+
if: matrix.node-version == 18
49+
with:
50+
file: ./coverage/lcov.info
51+
flags: unittests
52+
name: codecov-umbrella
53+
continue-on-error: true
54+
55+
build:
56+
name: Build Package
57+
runs-on: ubuntu-latest
58+
needs: test
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v4
63+
64+
- name: Setup Node.js
65+
uses: actions/setup-node@v4
66+
with:
67+
node-version: '18'
68+
cache: 'npm'
69+
70+
- name: Install dependencies
71+
run: npm ci
72+
73+
- name: Build TypeScript
74+
run: npm run build
75+
76+
- name: Verify build output
77+
run: |
78+
echo "Build directory contents:"
79+
ls -la build/
80+
echo "Verifying main entry point..."
81+
node -e "
82+
try {
83+
require('./build/server.js');
84+
console.log('✅ Build verification: SUCCESS');
85+
} catch (error) {
86+
console.error('❌ Build verification: FAILED');
87+
console.error(error.message);
88+
process.exit(1);
89+
}
90+
"
91+
92+
- name: Test package installation
93+
run: |
94+
npm pack
95+
PACKAGE_FILE=$(ls *.tgz)
96+
echo "Testing package installation: $PACKAGE_FILE"
97+
mkdir test-install && cd test-install
98+
npm init -y
99+
npm install ../$PACKAGE_FILE
100+
echo "✅ Package installation test: SUCCESS"
101+
102+
security:
103+
name: Security Audit
104+
runs-on: ubuntu-latest
105+
106+
steps:
107+
- name: Checkout code
108+
uses: actions/checkout@v4
109+
110+
- name: Setup Node.js
111+
uses: actions/setup-node@v4
112+
with:
113+
node-version: '18'
114+
cache: 'npm'
115+
116+
- name: Install dependencies
117+
run: npm ci
118+
119+
- name: Run security audit
120+
run: npm audit --audit-level=moderate
121+
122+
- name: Check for known vulnerabilities
123+
run: |
124+
if npm audit --audit-level=high --json | jq '.vulnerabilities | length' | grep -q '^0$'; then
125+
echo "✅ No high-severity vulnerabilities found"
126+
else
127+
echo "❌ High-severity vulnerabilities detected"
128+
npm audit --audit-level=high
129+
exit 1
130+
fi
131+
continue-on-error: true
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: Create Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version (e.g., 0.10.1)'
8+
required: true
9+
type: string
10+
prerelease:
11+
description: 'Mark as pre-release'
12+
required: false
13+
type: boolean
14+
default: false
15+
16+
jobs:
17+
create-release:
18+
name: Create GitHub Release
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '18'
31+
cache: 'npm'
32+
33+
- name: Validate version format
34+
run: |
35+
VERSION="${{ github.event.inputs.version }}"
36+
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$ ]]; then
37+
echo "❌ Invalid version format: $VERSION"
38+
echo "Expected format: X.Y.Z or X.Y.Z-prerelease"
39+
exit 1
40+
fi
41+
echo "✅ Version format is valid: $VERSION"
42+
43+
- name: Check if version matches package.json
44+
run: |
45+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
46+
INPUT_VERSION="${{ github.event.inputs.version }}"
47+
48+
if [ "$PACKAGE_VERSION" != "$INPUT_VERSION" ]; then
49+
echo "❌ Version mismatch!"
50+
echo "package.json version: $PACKAGE_VERSION"
51+
echo "Input version: $INPUT_VERSION"
52+
echo "Please update package.json version to match the release version."
53+
exit 1
54+
fi
55+
echo "✅ Version matches package.json: $PACKAGE_VERSION"
56+
57+
- name: Install dependencies and run tests
58+
run: |
59+
npm ci
60+
npm test
61+
npm run build
62+
63+
- name: Generate release notes
64+
id: release_notes
65+
run: |
66+
VERSION="${{ github.event.inputs.version }}"
67+
68+
# Get the latest tag for comparison
69+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
70+
71+
cat > release_notes.md << 'EOF'
72+
# 🚀 n8n-workflow-builder v${{ github.event.inputs.version }}
73+
74+
## 🎯 What's New in v${{ github.event.inputs.version }}
75+
76+
### ⚡ Major Upgrades
77+
- **MCP SDK 1.17.0 Compatibility**: Fully upgraded to the latest Model Context Protocol SDK
78+
- **TypeScript 5.7.3**: Latest TypeScript with enhanced type safety and performance
79+
- **Modern Jest Testing**: Comprehensive test suite with ts-jest integration
80+
81+
### 🛠️ New MCP Tools (23 Total)
82+
- `execute_workflow` - Execute n8n workflows programmatically
83+
- `create_workflow_and_activate` - Create and immediately activate workflows
84+
- `generate_audit` - Generate comprehensive security audit reports
85+
- **Credential Management**: `create_credential`, `get_credential_schema`, `delete_credential`
86+
- **Tag Management**: `list_tags`, `create_tag`, `get_tag`, `update_tag`, `delete_tag`, `get_workflow_tags`, `update_workflow_tags`
87+
88+
### 🧪 Testing Excellence
89+
- **78 Comprehensive Tests** covering all 23 MCP tools
90+
- **7 Test Suites** with integration and unit testing
91+
- **Mock Client Framework** for reliable testing
92+
- **Error Handling Tests** for robust error scenarios
93+
- **TypeScript Strict Mode** with full type safety
94+
95+
### 🏗️ Repository Modernization
96+
- **Clean Git History**: Removed accidentally committed `node_modules`
97+
- **Comprehensive .gitignore**: Node.js best practices implementation
98+
- **GitHub Actions CI/CD**: Automated testing and npm publishing
99+
- **Package Optimization**: Proper npm package configuration
100+
101+
### 📦 Installation & Usage
102+
103+
```bash
104+
# Install via npm
105+
npm install @makafeli/n8n-workflow-builder
106+
107+
# Use as MCP server
108+
npx @makafeli/n8n-workflow-builder
109+
```
110+
111+
### 🔧 Technical Specifications
112+
- **Node.js**: >=18.0.0
113+
- **MCP SDK**: ^1.17.0
114+
- **TypeScript**: ^5.7.3
115+
- **Testing**: Jest with ts-jest
116+
- **Package Size**: Optimized for production
117+
118+
### 🐛 Bug Fixes & Improvements
119+
- Fixed TypeScript configuration issues
120+
- Resolved MCP SDK compatibility problems
121+
- Enhanced error handling and validation
122+
- Improved test reliability and coverage
123+
- Optimized build process and package size
124+
125+
### 📚 Documentation
126+
- Updated README with latest features
127+
- Comprehensive API documentation
128+
- Testing guidelines and examples
129+
- Contributing guidelines
130+
131+
---
132+
133+
**Full Changelog**: https://github.com/makafeli/n8n-workflow-builder/compare/v0.9.0...v${{ github.event.inputs.version }}
134+
135+
**NPM Package**: https://www.npmjs.com/package/@makafeli/n8n-workflow-builder
136+
EOF
137+
138+
echo "release_notes_file=release_notes.md" >> $GITHUB_OUTPUT
139+
140+
- name: Create Git tag
141+
run: |
142+
VERSION="v${{ github.event.inputs.version }}"
143+
git config user.name "github-actions[bot]"
144+
git config user.email "github-actions[bot]@users.noreply.github.com"
145+
git tag -a "$VERSION" -m "Release $VERSION"
146+
git push origin "$VERSION"
147+
148+
- name: Create GitHub Release
149+
uses: actions/create-release@v1
150+
env:
151+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152+
with:
153+
tag_name: v${{ github.event.inputs.version }}
154+
release_name: n8n-workflow-builder v${{ github.event.inputs.version }}
155+
body_path: release_notes.md
156+
draft: false
157+
prerelease: ${{ github.event.inputs.prerelease }}
158+
159+
- name: Create release summary
160+
run: |
161+
echo "## 🎉 Release Created Successfully!" >> $GITHUB_STEP_SUMMARY
162+
echo "" >> $GITHUB_STEP_SUMMARY
163+
echo "**Version:** v${{ github.event.inputs.version }}" >> $GITHUB_STEP_SUMMARY
164+
echo "**Tag:** v${{ github.event.inputs.version }}" >> $GITHUB_STEP_SUMMARY
165+
echo "**Pre-release:** ${{ github.event.inputs.prerelease }}" >> $GITHUB_STEP_SUMMARY
166+
echo "" >> $GITHUB_STEP_SUMMARY
167+
echo "### 📦 Next Steps" >> $GITHUB_STEP_SUMMARY
168+
echo "1. The release will automatically trigger npm publishing" >> $GITHUB_STEP_SUMMARY
169+
echo "2. Package will be available at: https://www.npmjs.com/package/@makafeli/n8n-workflow-builder" >> $GITHUB_STEP_SUMMARY
170+
echo "3. Installation: \`npm install @makafeli/n8n-workflow-builder\`" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)