updated readme for npm #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline NPM Publish | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: [ published ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18.x, 20.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linting | |
| run: npm run lint | |
| - name: Run tests | |
| run: npm test | |
| - name: Build main SDK | |
| run: npm run build | |
| - name: Build project | |
| run: npm run build:examples | |
| - name: Run sync features check | |
| run: npm run sync-features | |
| build: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' || (github.ref == 'refs/heads/main' && github.event_name == 'push') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run full test suite | |
| run: npm test | |
| - name: Build main SDK | |
| run: npm run build || { echo 'Build failed!'; exit 1; } | |
| - name: Build project | |
| run: npm run build:examples || { echo 'Build examples failed!'; exit 1; } | |
| - name: List dist directory contents (debug) | |
| run: | | |
| echo 'Contents of dist:' | |
| ls -l dist/ | |
| echo 'Contents of dist/example:' | |
| ls -l dist/example/ | |
| - name: Verify build output | |
| run: | | |
| if [ ! -f dist/index.js ]; then echo "dist/index.js not found!" && exit 1; fi | |
| node -e "import('./dist/index.js').then(() => console.log('✅ Main SDK imports successfully'))" | |
| - name: Test example scripts | |
| run: | | |
| echo "Testing compiled examples..." | |
| node -e "import('./dist/example/comprehensive-demo.js').then(() => console.log('✅ Comprehensive demo imports successfully'))" | |
| node -e "import('./dist/example/run-agent.js').then(() => console.log('✅ Run agent imports successfully'))" | |
| node -e "import('./dist/example/advanced-usage.js').then(() => console.log('✅ Advanced usage imports successfully'))" | |
| publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| always-auth: true | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build main SDK | |
| run: npm run build | |
| - name: Build project | |
| run: npm run build:examples | |
| - name: Publish to npm | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run security audit (moderate) | |
| run: npm audit --audit-level=moderate | |
| - name: Check for vulnerabilities (high) | |
| run: npm audit --audit-level=high | |
| continue-on-error: true | |
| documentation: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate feature sync report | |
| run: npm run sync-features | |
| - name: Upload feature sync report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: feature-sync-report | |
| path: feature-sync-report.json |