Skip to content

chore: prepare release v0.2.0 #7

chore: prepare release v0.2.0

chore: prepare release v0.2.0 #7

Workflow file for this run

name: Version Consistency Check
on:
pull_request:
paths:
- "plugins/plugin-dev/.claude-plugin/plugin.json"
- ".claude-plugin/marketplace.json"
- "CLAUDE.md"
workflow_dispatch: # Manual trigger for pre-release checks
# Cancel any in-progress check for the same PR when new commits are pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check-versions:
# Skip bots
if: |
github.actor != 'dependabot[bot]' &&
github.actor != 'claude[bot]'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 1
- name: Check version consistency
uses: anthropics/claude-code-action@97b8aadc01f558e46e7faacdb4461a3dc6c73c56 # v1.0.23
id: version-check
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
Check version consistency across all plugin version files.
## Files to Check
1. `plugins/plugin-dev/.claude-plugin/plugin.json` - Extract `version` field (source of truth)
2. `.claude-plugin/marketplace.json` - Extract BOTH:
- `metadata.version` field
- `plugins[0].version` field
3. `CLAUDE.md` - Extract version from Quick Reference section (pattern: `**Current Version**: vX.Y.Z`)
## Instructions
1. Read plugin.json and extract the version (this is the expected version)
2. Read marketplace.json and extract both version fields
3. Read CLAUDE.md and extract version from the "Current Version" line in Quick Reference
4. Compare all versions against the plugin.json version
5. Return structured JSON with results
claude_args: |
--allowedTools "Read"
--json-schema '{"type":"object","properties":{"plugin_json_version":{"type":"string","description":"Version from plugin.json"},"marketplace_metadata_version":{"type":"string","description":"Version from marketplace.json metadata.version"},"marketplace_plugin_version":{"type":"string","description":"Version from marketplace.json plugins[0].version"},"claude_md_version":{"type":"string","description":"Version from CLAUDE.md Quick Reference"},"all_match":{"type":"boolean","description":"True if all versions match plugin.json"},"expected_version":{"type":"string","description":"The expected version (from plugin.json)"},"mismatches":{"type":"array","description":"List of files with mismatched versions","items":{"type":"string"}}},"required":["plugin_json_version","all_match","expected_version","mismatches"]}'
- name: Report version status
if: always() && steps.version-check.outputs.structured_output != ''
env:
VERSION_OUTPUT: ${{ steps.version-check.outputs.structured_output }}
run: |
{
echo "## Version Consistency Check Results"
echo '```json'
echo "$VERSION_OUTPUT" | jq .
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Fail if mismatched
if: always() && steps.version-check.outputs.structured_output != ''
env:
VERSION_OUTPUT: ${{ steps.version-check.outputs.structured_output }}
run: |
# Validate JSON output before processing
if ! all_match=$(echo "$VERSION_OUTPUT" | jq -r '.all_match' 2>/dev/null); then
echo "Error: Invalid JSON output from version check step"
echo "Raw output:"
echo "$VERSION_OUTPUT"
exit 1
fi
if [ "$all_match" != "true" ]; then
expected=$(echo "$VERSION_OUTPUT" | jq -r '.expected_version')
echo "❌ Version mismatch detected!"
echo ""
echo "Expected version: $expected"
echo ""
echo "Mismatches:"
echo "$VERSION_OUTPUT" | jq -r '.mismatches[]' | while read -r mismatch; do
echo " - $mismatch"
done
echo ""
echo "Please update all version files to match plugin.json version ($expected)"
exit 1
fi
expected=$(echo "$VERSION_OUTPUT" | jq -r '.expected_version')
echo "✅ All versions match: $expected"