Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 0 additions & 76 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,79 +65,3 @@ jobs:
run: |
node dist/cli.js help
timeout 5 node dist/cli.js mcp test || true

release:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write # Required to push git tags and create releases

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Check if version changed
id: version
run: |
PUBLISHED_VERSION=$(npm view claudine version 2>/dev/null || echo "0.0.0")
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "Published version: $PUBLISHED_VERSION"
echo "Package version: $PACKAGE_VERSION"
echo "published=$PUBLISHED_VERSION" >> $GITHUB_OUTPUT
echo "package=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
if [ "$PUBLISHED_VERSION" != "$PACKAGE_VERSION" ]; then
echo "Version has changed, will publish to npm"
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "Version unchanged, skipping npm publish"
echo "changed=false" >> $GITHUB_OUTPUT
fi

- name: Check for release notes
if: steps.version.outputs.changed == 'true'
run: |
RELEASE_NOTES_FILE="docs/releases/RELEASE_NOTES_v${{ steps.version.outputs.package }}.md"
if [ ! -f "$RELEASE_NOTES_FILE" ]; then
echo "❌ Error: $RELEASE_NOTES_FILE not found!"
echo "Release notes are required for version ${{ steps.version.outputs.package }}"
echo "Please create $RELEASE_NOTES_FILE with release notes before publishing"
exit 1
fi
echo "✅ Release notes found: $RELEASE_NOTES_FILE"

- name: Publish to npm
if: steps.version.outputs.changed == 'true'
run: |
echo "Publishing version ${{ steps.version.outputs.package }} to npm..."
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create git tag
if: steps.version.outputs.changed == 'true'
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag v${{ steps.version.outputs.package }}
git push origin v${{ steps.version.outputs.package }}

- name: Create GitHub release
if: steps.version.outputs.changed == 'true'
run: |
gh release create v${{ steps.version.outputs.package }} \
--title "🚀 Claudine v${{ steps.version.outputs.package }}" \
--notes-file docs/releases/RELEASE_NOTES_v${{ steps.version.outputs.package }}.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86 changes: 53 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,75 @@
name: Release

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish-npm:
release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm test

- name: Update package version to match tag

- name: Run tests
run: NODE_OPTIONS="--max-old-space-size=2048" npm run test:all

- name: Check version
id: version
run: |
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG#v}
npm version $VERSION --no-git-tag-version --allow-same-version

PUBLISHED_VERSION=$(npm view claudine version 2>/dev/null || echo "0.0.0")
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "Published version: $PUBLISHED_VERSION"
echo "Package version: $PACKAGE_VERSION"
echo "published=$PUBLISHED_VERSION" >> $GITHUB_OUTPUT
echo "package=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
if [ "$PUBLISHED_VERSION" = "$PACKAGE_VERSION" ]; then
echo "❌ Version $PACKAGE_VERSION is already published. Bump version in package.json first."
exit 1
fi

- name: Check for release notes
run: |
RELEASE_NOTES_FILE="docs/releases/RELEASE_NOTES_v${{ steps.version.outputs.package }}.md"
if [ ! -f "$RELEASE_NOTES_FILE" ]; then
echo "❌ Error: $RELEASE_NOTES_FILE not found!"
echo "Release notes are required for version ${{ steps.version.outputs.package }}"
echo "Please create $RELEASE_NOTES_FILE with release notes before publishing"
exit 1
fi
echo "✅ Release notes found: $RELEASE_NOTES_FILE"

- name: Publish to npm
run: npm publish --access public
run: |
echo "Publishing version ${{ steps.version.outputs.package }} to npm..."
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Update release notes
uses: actions/github-script@v7
with:
script: |
const tag = context.ref.replace('refs/tags/', '');
const version = tag.replace('v', '');
const release = context.payload.release;
const newBody = release.body + `\n\n---\n\n📦 **Published to npm**: Version ${version}\n\nInstall with: \`npm install -g claudine@${version}\``;

await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
body: newBody
});

- name: Create git tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag v${{ steps.version.outputs.package }}
git push origin v${{ steps.version.outputs.package }}

- name: Create GitHub release
run: |
gh release create v${{ steps.version.outputs.package }} \
--title "Claudine v${{ steps.version.outputs.package }}" \
--notes-file docs/releases/RELEASE_NOTES_v${{ steps.version.outputs.package }}.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 changes: 4 additions & 25 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,32 +97,11 @@ See `docs/TASK-DEPENDENCIES.md` for usage patterns.

### Release Workflow

1. **Create PR**:
```bash
git add package.json docs/releases/RELEASE_NOTES_v*.md
git commit -m "chore: prepare v0.3.1 release"
git push origin feature/your-branch
gh pr create --title "Release v0.3.1" --body "See docs/releases/RELEASE_NOTES_v0.3.1.md"
```

2. **Merge to main** - CI automatically:
- Validates release notes exist
- Publishes to npm (`claudine@{version}`)
- Creates git tag (`v{version}`)
- Creates GitHub release

**CI will FAIL if** `docs/releases/RELEASE_NOTES_v{version}.md` is missing.
1. **Merge version bump + release notes to main** via normal PR
2. **Trigger release manually** from GitHub Actions → Release → Run workflow
- The workflow validates version is unpublished, checks release notes exist, runs tests, publishes to npm, creates git tag, and creates GitHub release

### Emergency Release

If CI fails:
```bash
# Manual tag creation
git tag v{version} && git push origin v{version}

# Manual GitHub release
gh release create v{version} --notes-file docs/releases/RELEASE_NOTES_v{version}.md
```
**Publishing is never automatic.** Merging a version bump to main does NOT publish. You must explicitly trigger the Release workflow.

## Project-Specific Guidelines

Expand Down