Skip to content

Release

Release #4

Workflow file for this run

# =============================================================================
# CodeOps MCP Server — NPM Publish Workflow
# =============================================================================
#
# This workflow builds, tests, and publishes the package to npm.
#
# STATUS: INACTIVE — Currently using workflow_dispatch (manual trigger only).
# To activate automatic publishing on release:
# 1. Uncomment the "on.release" trigger below
# 2. Remove or keep the "workflow_dispatch" trigger
# 3. Add NPM_TOKEN to repository secrets
#
# To publish manually:
# 1. Go to Actions tab → "Publish to npm" → "Run workflow"
# 2. Select branch and click "Run workflow"
#
# Prerequisites:
# - NPM_TOKEN secret must be set in repository settings
# (npm → Access Tokens → Generate New Token → Automation)
# =============================================================================
name: Publish to npm
on:
# Manual trigger only (inactive by default)
workflow_dispatch:
inputs:
dry_run:
description: "Dry run (skip actual publish)"
required: false
default: "true"
type: choice
options:
- "true"
- "false"
# UNCOMMENT TO ACTIVATE: Publish on GitHub release
# release:
# types: [published]
jobs:
# ===========================================================================
# Job 1: Build and Test
# ===========================================================================
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Run tests
run: yarn test
# ===========================================================================
# Job 2: Publish to npm
# ===========================================================================
publish:
name: Publish to npm
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Run tests
run: yarn test
- name: Verify package contents
run: npm pack --dry-run
- name: Publish to npm (dry run)
if: ${{ github.event.inputs.dry_run == 'true' || github.event.inputs.dry_run == '' }}
run: npm publish --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
if: ${{ github.event.inputs.dry_run == 'false' || github.event_name == 'release' }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# ===========================================================================
# Job 3: Verify published package (optional)
# ===========================================================================
verify:
name: Verify Published Package
runs-on: ubuntu-latest
needs: publish
if: ${{ github.event.inputs.dry_run == 'false' || github.event_name == 'release' }}
steps:
- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
- name: Wait for npm propagation
run: sleep 30
- name: Install published package globally
run: npm install -g codeops-mcp
- name: Verify binary exists
run: which codeops-mcp
- name: Verify version
run: codeops-mcp --version || echo "Version flag not implemented yet"