Skip to content

0.5.1

0.5.1 #28

Workflow file for this run

name: Publish to npm
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ github.ref_name }}
run: gh release create "$TAG_NAME" --generate-notes --latest
- name: Generate release notes with Claude
env:
GH_TOKEN: ${{ github.token }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
TAG_NAME: ${{ github.ref_name }}
REPO: ${{ github.repository }}
run: |
# Find previous tag
PREV_TAG=$(git tag --sort=-version:refname | grep -v "^${TAG_NAME}$" | head -1)
echo "Generating notes for ${PREV_TAG}..${TAG_NAME}"
# Build context: commit log + diff stat + actual diff (truncated)
COMMITS=$(git log "${PREV_TAG}..${TAG_NAME}" --pretty=format:"- %s (%h)" --no-merges)
DIFFSTAT=$(git diff "${PREV_TAG}..${TAG_NAME}" --stat)
DIFF=$(git diff "${PREV_TAG}..${TAG_NAME}" | head -500)
# Build the prompt
PROMPT=$(cat <<'PROMPT_EOF'
You are writing release notes for a CLI tool called claude-sidecar.
Write rich, categorized release notes in this exact style:
## What's Changed
### [Category Name]
- **[Short title]**: Description of what changed and why it matters.
**Full Changelog**: CHANGELOG_LINK
Rules:
- Group related changes under descriptive headings (Features, Bug Fixes, Improvements, Infrastructure, etc.)
- Each bullet should explain WHAT changed and WHY, not just repeat the commit message
- Bold the key phrase in each bullet for scannability
- Skip version-bump-only commits (e.g. "0.4.4")
- Skip docs-only and chore commits unless they are user-facing
- Keep it concise but informative. 2-3 sentences per item max.
- Always end with the Full Changelog link
- Do NOT use em dashes. Use commas, periods, or parentheses instead.
- Output ONLY the release notes markdown. No preamble, no code fences.
PROMPT_EOF
)
# Call Claude API
RESPONSE=$(jq -n \
--arg prompt "$PROMPT" \
--arg commits "$COMMITS" \
--arg diffstat "$DIFFSTAT" \
--arg diff "$DIFF" \
--arg prev_tag "$PREV_TAG" \
--arg tag "$TAG_NAME" \
--arg repo "$REPO" \
'{
model: "claude-haiku-4-5-20251001",
max_tokens: 2048,
messages: [{
role: "user",
content: ("Here are the commits from " + $prev_tag + " to " + $tag + ":\n\n" + $commits + "\n\nDiff stat:\n" + $diffstat + "\n\nActual diff (truncated):\n" + $diff + "\n\nChangelog link: https://github.com/" + $repo + "/compare/" + $prev_tag + "..." + $tag + "\n\n" + $prompt)
}]
}' | curl -s https://api.anthropic.com/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: ${ANTHROPIC_API_KEY}" \
-H "anthropic-version: 2023-06-01" \
-d @-)
# Extract the text content
NOTES=$(echo "$RESPONSE" | jq -r '.content[0].text // empty')
if [ -z "$NOTES" ]; then
echo "Warning: Claude API returned no content. Keeping default release notes."
echo "Response: $RESPONSE"
exit 0
fi
# Update the release
echo "$NOTES" | gh release edit "$TAG_NAME" --notes-file -
echo "Release notes updated successfully"