Skip to content

Commit 7b65afa

Browse files
authored
Merge pull request #16 from saturdaymp/feature/add-gitversion
Updated config to have stable and latest release channels. Add a workflow that will auto-magically tag a release and update the version number.
2 parents 19ae97d + 0475fed commit 7b65afa

6 files changed

Lines changed: 159 additions & 7 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,21 @@
88
"plugins": [
99
{
1010
"name": "smp-github",
11-
"description": "Useful tools for interacting with GitHub.",
11+
"description": "Useful tools for interacting with GitHub. Stable channel, updated on each release.",
12+
"category": "development",
13+
"source": {
14+
"source": "git-subdir",
15+
"url": "https://github.com/saturdaymp/claude-plugins.git",
16+
"path": "plugins/smp-github",
17+
"ref": "main",
18+
"sha": "19ae97d2b9f7bb7760a324ba4c3b53fbd937e850"
19+
},
20+
"version": "1.0.0",
21+
"homepage": "https://github.com/saturdaymp/claude-plugins"
22+
},
23+
{
24+
"name": "smp-github-latest",
25+
"description": "Useful tools for interacting with GitHub. Latest channel, updated on every commit.",
1226
"category": "development",
1327
"source": "./plugins/smp-github",
1428
"homepage": "https://github.com/saturdaymp/claude-plugins"

.github/workflows/release.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to release (e.g. 1.2.3). Leave blank to use the GitVersion calculated version.'
8+
required: false
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
name: Create Release
17+
if: github.ref == 'refs/heads/main'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v7
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Install GitVersion
26+
if: inputs.version == ''
27+
uses: gittools/actions/gitversion/setup@v4
28+
with:
29+
versionSpec: '6.x'
30+
31+
- name: Run GitVersion
32+
if: inputs.version == ''
33+
id: gitversion
34+
uses: gittools/actions/gitversion/execute@v4
35+
36+
- name: Determine version
37+
id: version
38+
env:
39+
MANUAL_VERSION: ${{ inputs.version }}
40+
GITVERSION_VERSION: ${{ steps.gitversion.outputs.majorMinorPatch }}
41+
run: |
42+
MANUAL_VERSION="${MANUAL_VERSION#v}"
43+
echo "version=${MANUAL_VERSION:-$GITVERSION_VERSION}" >> "$GITHUB_OUTPUT"
44+
45+
- name: Tag release
46+
env:
47+
VERSION: ${{ steps.version.outputs.version }}
48+
run: |
49+
git config user.name "github-actions[bot]"
50+
git config user.email "github-actions[bot]@users.noreply.github.com"
51+
git tag "v${VERSION}"
52+
git push origin "v${VERSION}"
53+
54+
- name: Create GitHub release
55+
env:
56+
GH_TOKEN: ${{ github.token }}
57+
VERSION: ${{ steps.version.outputs.version }}
58+
run: gh release create "v${VERSION}" --generate-notes
59+
60+
- name: Update stable channel and changelog
61+
env:
62+
GH_TOKEN: ${{ github.token }}
63+
VERSION: ${{ steps.version.outputs.version }}
64+
run: |
65+
jq --arg version "$VERSION" \
66+
'(.plugins[] | select(.name == "smp-github")) |= (.source.ref = "v" + $version | del(.source.sha) | .version = $version)' \
67+
.claude-plugin/marketplace.json > marketplace.tmp
68+
mv marketplace.tmp .claude-plugin/marketplace.json
69+
./scripts/generate-changelog.sh
70+
git add .claude-plugin/marketplace.json CHANGELOG.md
71+
git commit -m "Release v${VERSION}"
72+
git push origin HEAD:main

.github/workflows/version.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Version
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
version:
13+
name: Calculate Version
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v7
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Install GitVersion
22+
uses: gittools/actions/gitversion/setup@v4
23+
with:
24+
versionSpec: '6.x'
25+
26+
- name: Run GitVersion
27+
id: gitversion
28+
uses: gittools/actions/gitversion/execute@v4
29+
30+
- name: Show version
31+
run: |
32+
echo "## Next release: ${{ steps.gitversion.outputs.majorMinorPatch }} (${{ steps.gitversion.outputs.fullSemVer }})" >> "$GITHUB_STEP_SUMMARY"

GitVersion.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
workflow: GitHubFlow/v1
2+
3+
# GitHubFlow/v1 defaults: the next version is one increment past the most
4+
# recent release tag, regardless of how many PRs have merged since. The
5+
# Release workflow tags main, which anchors the next calculation.
6+
branches:
7+
main:
8+
increment: Minor

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ Load the local marketplace:
3434

3535
## Plugins
3636

37-
Install plugins:
37+
Each plugin is published on two release channels:
38+
39+
- **Stable** (e.g. `smp-github`): pinned to the most recent release tag, updated only when a release is published.
40+
- **Latest** (e.g. `smp-github-latest`): tracks the `main` branch, updated on every commit.
41+
42+
Install the channel you want:
3843

3944
```
40-
/plugin install smp-github@saturdaymp/claude-plugins
45+
/plugin install smp-github@saturdaymp-claude-plugins
46+
/plugin install smp-github-latest@saturdaymp-claude-plugins
4147
```
4248

4349
Don't forget to restart Claude Code or try reloading the plugins:
@@ -48,9 +54,30 @@ Don't forget to restart Claude Code or try reloading the plugins:
4854

4955
### Plugins Available
5056

51-
| Plugin | Description |
52-
|--------|-------------|
53-
| [smp-github](plugins/smp-github/) | GitHub skills — PR review feedback workflow |
57+
| Plugin | Channels | Description |
58+
|--------|----------|-------------|
59+
| [smp-github](plugins/smp-github/) | `smp-github`, `smp-github-latest` | GitHub skills — PR review feedback workflow |
60+
61+
## Versioning and Releases
62+
63+
This repo uses [GitVersion](https://gitversion.net) (see [GitVersion.yml](GitVersion.yml)): the next release version is one minor bump past the most recent release tag, no matter how many PRs have merged since. To bump differently, include `+semver: major` or `+semver: patch` in a commit message on `main`.
64+
65+
Stable channel users only receive updates when the plugin's `version` and `ref` in [.claude-plugin/marketplace.json](.claude-plugin/marketplace.json) change, which the Release workflow handles. Latest channel users receive updates on every commit to `main` because the latest entries omit `version`, so each commit SHA counts as a new version. For the same reason, plugin manifests (`plugin.json`) must not declare a `version` — it would take precedence over the marketplace entry and pin both channels to the same version.
66+
67+
The [Version workflow](.github/workflows/version.yml) prints the calculated version in its run summary for every push and pull request to `main`. To calculate it locally instead:
68+
69+
```bash
70+
docker run --rm -v "$PWD:/repo" gittools/gitversion:6.3.0 /repo
71+
```
72+
73+
### Releasing
74+
75+
Run the [Release workflow](.github/workflows/release.yml) from the GitHub Actions tab. It:
76+
77+
1. Calculates the next version with GitVersion.
78+
2. Tags `main` with `vX.Y.Z` and creates a GitHub release with generated notes.
79+
3. Points the stable channel entries in `marketplace.json` at the new tag.
80+
4. Regenerates `CHANGELOG.md` and commits both files to `main` as `Release vX.Y.Z`.
5481

5582
### Generating the Changelog
5683

plugins/smp-github/.claude-plugin/plugin.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "smp-github",
3-
"version": "1.0.0",
43
"description": "Useful tools for interacting with GitHub.",
54
"author": {
65
"name": "Saturday Morning Productions Inc."

0 commit comments

Comments
 (0)