Skip to content

Merge pull request #42 from iamvirul/dependabot/npm_and_yarn/npm_and_… #11

Merge pull request #42 from iamvirul/dependabot/npm_and_yarn/npm_and_…

Merge pull request #42 from iamvirul/dependabot/npm_and_yarn/npm_and_… #11

Workflow file for this run

name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-*"
permissions:
contents: write # create GitHub release
id-token: write # npm provenance attestation
packages: write # publish to GitHub Packages
jobs:
release:
name: Build, GitHub Release & npm Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: npm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci
- name: Type-check
run: npm run type-check
- name: Build
run: npm run build
- name: Verify package version matches tag
run: |
PKG_VERSION="v$(node -p "require('./package.json').version")"
TAG_VERSION="${GITHUB_REF_NAME}"
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
echo "❌ package.json version ($PKG_VERSION) does not match tag ($TAG_VERSION)"
exit 1
fi
echo "✅ Version match: $PKG_VERSION"
- name: Extract changelog for this release
id: changelog
run: |
VERSION="${GITHUB_REF_NAME#v}" # strip leading 'v'
# Extract the block for this version from CHANGELOG.md:
# Matches from "## [X.Y.Z]" down to (but not including) the next "## ["
NOTES=$(awk "/^## \[${VERSION}\]/{found=1; next} found && /^## \[/{exit} found{print}" CHANGELOG.md)
if [ -z "$NOTES" ]; then
echo "⚠️ No CHANGELOG entry found for $VERSION — using git log as fallback"
PREV_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | sed -n '2p')
if [ -z "$PREV_TAG" ]; then
NOTES=$(git log --pretty=format:"- %s" HEAD)
else
NOTES=$(git log --pretty=format:"- %s" "${PREV_TAG}..HEAD")
fi
fi
echo "notes<<EOF" >> "$GITHUB_OUTPUT"
echo "$NOTES" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body: |
${{ steps.changelog.outputs.notes }}
---
**Install:** `npm install council-mcp`
**Use in Claude Code MCP config:**
```json
{
"mcpServers": {
"the-council": {
"command": "npx",
"args": ["-y", "council-mcp"]
}
}
}
```
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
generate_release_notes: false
- name: Publish to npm
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup Node for GitHub Packages
uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: https://npm.pkg.github.com
- name: Publish to GitHub Packages
run: |
# GitHub Packages requires a scoped name — publish as @iamvirul/council-mcp
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.name = '@iamvirul/council-mcp';
pkg.publishConfig = { registry: 'https://npm.pkg.github.com' };
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}