diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d456423..2d52d64 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,12 @@ name: release # Pushing a tag v publishes a GitHub release with that version's section of CHANGELOG.md. +# Running it by hand (workflow_dispatch) on main does the same for the version in plugin.json, creating the tag +# v on the run's commit; it fails when that tag already exists. on: push: tags: ["v*"] + workflow_dispatch: permissions: contents: write @@ -15,14 +18,21 @@ jobs: - uses: actions/checkout@v4 - name: the tag matches plugin.json run: | - v="${GITHUB_REF_NAME#v}" p=$(python3 -c "import json; print(json.load(open('plugins/beanfx/.claude-plugin/plugin.json'))['version'])") - [ "$v" = "$p" ] || { echo "tag $GITHUB_REF_NAME but plugin.json says $p"; exit 1; } + if [ "$GITHUB_REF_TYPE" = tag ]; then + tag="$GITHUB_REF_NAME" + [ "${tag#v}" = "$p" ] || { echo "tag $tag but plugin.json says $p"; exit 1; } + else + [ "$GITHUB_REF_NAME" = main ] || { echo "run it on main, not $GITHUB_REF_NAME"; exit 1; } + tag="v$p" + if git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null; then echo "$tag exists"; exit 1; fi + fi + echo "TAG=$tag" >> "$GITHUB_ENV" - name: notes from CHANGELOG.md run: | - v="${GITHUB_REF_NAME#v}" + v="${TAG#v}" awk -v v="$v" '/^## /{on = ($2 == v)} on' CHANGELOG.md | tail -n +2 > notes.md [ -s notes.md ] || { echo "CHANGELOG.md has no section for $v"; exit 1; } - - run: gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file notes.md + - run: gh release create "$TAG" --target "$GITHUB_SHA" --title "$TAG" --notes-file notes.md env: GH_TOKEN: ${{ github.token }} diff --git a/CHANGELOG.md b/CHANGELOG.md index eeeaab9..02a16b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ The phases knob: how a cast's time splits, with timing recommendations (2026-11- cinematic) with seconds and frames, an ASCII timeline, and timing recommendations (wind-up at least 3 frames and a short hold, a 1 to 2 frame release, travel from distance over speed, player skills under about 1 s to the impact, longer tells for enemies). The split goes into `Spec.windup` and `Spec.poses`. The gate now has 18 knobs. +- The release workflow also runs by hand on `main`: it creates the tag `v` from `plugin.json` and + publishes the release, for when tags cannot be pushed (`CONTRIBUTING.md`). ## 2.3.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ced9ba..2588084 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,3 +71,5 @@ add one only when a page links it, and remove one that nothing links any more. C 2. Set the same version in `plugins/beanfx/.claude-plugin/plugin.json`. 3. Merge to `main`, then `git tag v && git push origin v`. The release workflow checks the tag against `plugin.json` and publishes a GitHub release with that section of the changelog. + Where tags cannot be pushed, run the release workflow by hand on `main` (Actions, release, Run workflow): it + creates the tag `v` from `plugin.json` on that commit and publishes the same release.