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
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,26 @@ permissions:
contents: write

jobs:
verify-version:
name: Verify plugin.json version
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Check tag matches plugin.json
run: |
tag="${GITHUB_REF_NAME#v}"
plugin="$(jq -r .version .claude-plugin/plugin.json)"
if [ "$tag" != "$plugin" ]; then
echo "::error::Tag v$tag does not match .claude-plugin/plugin.json version $plugin. Run 'make release VERSION=$tag'."
exit 1
fi
echo "Tag matches plugin.json version: $plugin"

goreleaser:
name: GoReleaser
needs: verify-version
runs-on: ubuntu-24.04
steps:
- name: Checkout
Expand Down
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.PHONY: build test fmt lint clean run release-snapshot man
.PHONY: build test fmt lint clean run release release-snapshot man

BINARY := emailable
PKG := .
PLUGIN := .claude-plugin/plugin.json

build:
go build -o bin/$(BINARY) $(PKG)
Expand All @@ -22,6 +23,22 @@ clean:
run:
go run $(PKG) $(ARGS)

# Cut a release: sync the plugin manifest version, commit, and tag.
# Usage: make release VERSION=1.2.3
# Pushing the tag triggers the GoReleaser workflow, which also verifies the
# tag matches plugin.json (see .github/workflows/release.yml).
release:
ifndef VERSION
$(error VERSION is required, e.g. make release VERSION=1.2.3)
endif
@echo "$(VERSION)" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$$' || { echo "error: VERSION must be semver x.y.z (got '$(VERSION)')"; exit 1; }
@test -z "$$(git status --porcelain)" || { echo "error: working tree not clean; commit or stash first"; exit 1; }
@tmp=$$(mktemp) && sed -E 's/("version": *")[^"]*(")/\1$(VERSION)\2/' $(PLUGIN) > $$tmp && mv $$tmp $(PLUGIN)
@git add $(PLUGIN)
@git commit -m "Release v$(VERSION)"
@git tag -a v$(VERSION) -m "v$(VERSION)"
@echo "Tagged v$(VERSION). Push the commit and tag to release: git push --follow-tags"

release-snapshot:
goreleaser release --snapshot --clean

Expand Down