Skip to content
Closed
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
31 changes: 31 additions & 0 deletions .github/scripts/release-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
"""Prepare a patch release for changes to the review command instructions."""

import json
import re
import subprocess
from pathlib import Path

plugin = Path("plugins/proofline/.claude-plugin/plugin.json")
catalog = Path(".claude-plugin/marketplace.json")
command = Path("plugins/proofline/commands/review.md")
released = subprocess.check_output(["git", "log", "-1", "--format=%H", "--", plugin], text=True).strip()
previous = subprocess.check_output(["git", "show", f"{released}:{command}"])
current = command.read_bytes()
if current == previous:
raise SystemExit(0)
before, after = (data.split(b"---\n", 2) for data in (previous, current))
if len(before) != 3 or len(after) != 3 or before[:2] != after[:2]:
raise SystemExit("Command metadata changed. Review the command declaration before releasing.")
number = json.loads(plugin.read_bytes())["version"]
if not re.fullmatch(r"(?:0|[1-9][0-9]*)(?:\.(?:0|[1-9][0-9]*)){2}", number):
raise SystemExit("Expected a stable plugin version.")
major, minor, patch = map(int, number.split("."))
updated = f"{major}.{minor}.{patch + 1}"
for path in (plugin, catalog):
text = path.read_text()
old = f'"version": "{number}"'
if text.count(old) != 1:
raise SystemExit(f"{path} must contain the released version exactly once.")
path.write_text(text.replace(old, f'"version": "{updated}"'))
print(f"Prepared plugin version {updated}.")
65 changes: 65 additions & 0 deletions .github/workflows/command-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release command fixes
on:
push:
branches: [main]
paths: [plugins/proofline/commands/review.md]
pull_request:
paths:
- .github/scripts/release-command
- .github/workflows/command-release.yml
- plugins/proofline/commands/review.md
workflow_dispatch:

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Check a command-only release and a repeat run
run: |
git config user.name "Release check"
git config user.email "release-check@users.noreply.github.com"
git switch --detach
command=plugins/proofline/commands/review.md
plugin=plugins/proofline/.claude-plugin/plugin.json
catalog=.claude-plugin/marketplace.json
python3 .github/scripts/release-command
git add "$plugin" "$catalog"
if ! git diff --cached --quiet; then git commit -m "Prepare current command"; fi
printf '\nUse the installed command.\n' >> "$command"
git add "$command"
git commit -m "Exercise a command fix"
python3 .github/scripts/release-command
test "$(git diff --name-only | sort)" = "$(printf '%s\n' "$plugin" "$catalog" | sort)"
git add "$plugin" "$catalog"
git commit -m "Verify the patch version"
python3 .github/scripts/release-command
git diff --exit-code
release:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
needs: check
concurrency: release-review-command
permissions:
contents: write
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: main
fetch-depth: 0
persist-credentials: false
- run: python3 .github/scripts/release-command
- name: Publish the updated plugin version
env:
GH_TOKEN: ${{ github.token }}
run: |
git add .claude-plugin/marketplace.json plugins/proofline/.claude-plugin/plugin.json
if git diff --cached --quiet; then exit 0; fi
git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" commit -m "Release review command fix"
git -c credential.helper= -c 'credential.helper=!gh auth git-credential' push origin HEAD:refs/heads/main
60 changes: 0 additions & 60 deletions .github/workflows/sync.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Verify published skills

on: workflow_dispatch

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Compare the checkout with the published skills
run: |
curl --fail --silent --show-error --retry 3 --max-time 30 \
--output "$RUNNER_TEMP/repository.json" \
https://proofline.sh/.well-known/agent-skills/repository.json
python3 - "$RUNNER_TEMP/repository.json" <<'PY'
import json
import subprocess
import sys
from pathlib import Path

files = json.loads(Path(sys.argv[1]).read_bytes())["files"]
tracked = subprocess.check_output(["git", "ls-files", "-z"]).decode().split("\0")
managed = {p for p in tracked if p and p != "AGENTS.md" and not p.startswith(".github/")}
if set(files) != managed:
sys.exit("The published file list differs from the checkout.")
for name in sorted(managed):
path = Path(name)
if path.resolve() != Path.cwd() / name or path.read_bytes() != files[name].encode():
sys.exit(f"The published file differs from the checkout: {name}")
PY
Loading