Release Plugin #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Plugin | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| plugin: | |
| description: Plugin to release | |
| required: true | |
| type: choice | |
| options: | |
| - rdi | |
| - python-dev | |
| bump: | |
| description: Version bump type | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Release ${{ inputs.plugin }} | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure git identity | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Fetch tags | |
| run: git fetch --force --tags origin | |
| - name: Compute release version | |
| id: version | |
| run: | | |
| python3 scripts/compute_plugin_version.py \ | |
| --plugin "${{ inputs.plugin }}" \ | |
| --bump "${{ inputs.bump }}" \ | |
| --github-output "$GITHUB_OUTPUT" | |
| - name: Update plugin.json | |
| run: | | |
| python3 - <<'PYTHON' | |
| import json | |
| from pathlib import Path | |
| plugin_json_path = Path("plugins/${{ inputs.plugin }}/.claude-plugin/plugin.json") | |
| data = json.loads(plugin_json_path.read_text()) | |
| data["version"] = "${{ steps.version.outputs.new_version }}" | |
| plugin_json_path.write_text(json.dumps(data, indent=2) + "\n") | |
| PYTHON | |
| - name: Update marketplace.json | |
| run: | | |
| python3 - <<'PYTHON' | |
| import json | |
| from pathlib import Path | |
| marketplace_path = Path(".claude-plugin/marketplace.json") | |
| data = json.loads(marketplace_path.read_text()) | |
| for plugin in data.get("plugins", []): | |
| if plugin["name"] == "${{ inputs.plugin }}": | |
| plugin["version"] = "${{ steps.version.outputs.new_version }}" | |
| break | |
| marketplace_path.write_text(json.dumps(data, indent=2) + "\n") | |
| PYTHON | |
| - name: Commit version bump | |
| run: | | |
| git add plugins/${{ inputs.plugin }}/.claude-plugin/plugin.json | |
| git add .claude-plugin/marketplace.json | |
| git commit -m "chore: release ${{ inputs.plugin }} v${{ steps.version.outputs.new_version }}" | |
| - name: Push commit | |
| run: git push origin main | |
| - name: Create canonical tag | |
| run: | | |
| git tag -a "${{ steps.version.outputs.canonical_tag }}" \ | |
| -m "release: ${{ steps.version.outputs.canonical_tag }}" | |
| git push origin "${{ steps.version.outputs.canonical_tag }}" | |
| - name: Create and push alias tags | |
| run: | | |
| for tag in $(echo "${{ steps.version.outputs.alias_tags }}" | tr ',' ' '); do | |
| git tag -fa "$tag" -m "release alias: $tag" | |
| git push origin "refs/tags/$tag" --force | |
| done | |
| - name: Summary | |
| run: | | |
| echo "✅ Release complete!" | |
| echo "" | |
| echo "Plugin: ${{ inputs.plugin }}" | |
| echo "Version: v${{ steps.version.outputs.new_version }}" | |
| echo "" | |
| echo "📌 Tags created:" | |
| echo " Canonical: ${{ steps.version.outputs.canonical_tag }}" | |
| echo " Aliases: ${{ steps.version.outputs.alias_tags }}" |