diff options
| author | t <t@tjp.lol> | 2026-08-20 13:13:26 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-08-20 13:39:40 -0600 |
| commit | 11bd9d782147e883ea10d7a1697e0b97ac681fd0 (patch) | |
| tree | c22c8111f8d57604dc6f1196a955fa27746e46a6 | |
| parent | 2acd6b0e38e4af1fd13bad1cef8af7407b20684c (diff) | |
Prepare the 0.1.0 release and fix the self-checkv0.1.0
Add a LICENSE file, point source.url at code.tjp.lol with a v0.1.0 tag,
set version 0.1.0-1, and add homepage and labels so the rock can be
published to luarocks.org.
The self-check hardcoded the rockspec filename, which the version bump
broke; find it by glob instead so future releases cannot break it. It
also only passes under plain lua: its panto and luv stubs go through
package.preload, and the panto interpreter has both loaded already, so
the stubs never take effect. The mise check task runs plain lua.
Add mise tasks for cutting a version and publishing a release.
| -rw-r--r-- | LICENSE | 18 | ||||
| -rw-r--r-- | _selfcheck.lua | 15 | ||||
| -rw-r--r-- | mise.toml | 85 | ||||
| -rw-r--r-- | panto-herdr-0.1.0-1.rockspec (renamed from panto-herdr-scm-1.rockspec) | 8 |
4 files changed, 122 insertions, 4 deletions
@@ -0,0 +1,18 @@ +MIT License + +Copyright (c) 2026 Travis Parker + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/_selfcheck.lua b/_selfcheck.lua index b4d0396..8b83fa5 100644 --- a/_selfcheck.lua +++ b/_selfcheck.lua @@ -1,7 +1,20 @@ local events = {} local reports = {} -assert(loadfile("panto-herdr-scm-1.rockspec")) +-- Find the rockspec rather than naming it: the filename carries the version, +-- so hardcoding it breaks this check on every release. +-- +-- Deliberately shells out instead of using luv: the stubs below replace +-- `package.preload.luv`, and a `require("luv")` up here would cache the real +-- module first and quietly defeat them. +local function find_rockspec() + local ls = assert(io.popen("ls -1 ./*.rockspec 2>/dev/null")) + local name = ls:read("l") + ls:close() + return name +end + +assert(loadfile(assert(find_rockspec(), "no .rockspec in the repo root"))) package.preload.panto = function() return { diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..1af9274 --- /dev/null +++ b/mise.toml @@ -0,0 +1,85 @@ +# Release plumbing. `mise run version <x.y.z>` rewrites the rockspec, then you +# commit it and `mise run release` tags, pushes and uploads. +# +# Why not `luarocks new_version`: it regenerates the rockspec from the parsed +# table, so it silently drops every comment and reflows the tables. Two sed +# lines keep the file intact. + +[tasks.check] +# Plain `lua`, not `panto lua`: the self-check stubs `panto` and `luv` through +# package.preload, and panto's own interpreter has both loaded already, so the +# stubs never take effect and activate() registers against the real host. +description = "Run the self-check" +dir = "{{config_root}}" +run = "lua _selfcheck.lua" + +[tasks.version] +description = "Rewrite the rockspec for a new version (then commit it)" +dir = "{{config_root}}" +run = """ +set -eu +NEW="{{arg(name='version')}}" +SPEC="$(ls -1 ./*.rockspec)" +case "$SPEC" in *" +"*) echo "expected exactly one rockspec, found:" >&2; echo "$SPEC" >&2; exit 1;; esac + +PKG="$(sed -n 's/^package = "\\(.*\\)"/\\1/p' "$SPEC")" +NEWSPEC="./$PKG-$NEW-1.rockspec" + +# Write through a temp file: without it, a re-run at the same version would +# have the redirect truncate the file sed is still reading. +TMP="$(mktemp)" +sed -e "s/^version = \\".*\\"/version = \\"$NEW-1\\"/" \\ + -e "s/^\\( *\\)tag = \\"v[^\\"]*\\"/\\1tag = \\"v$NEW\\"/" "$SPEC" > "$TMP" +mv "$TMP" "$NEWSPEC" +[ "$SPEC" = "$NEWSPEC" ] || rm -f "$SPEC" + +luarocks lint "$NEWSPEC" +echo "wrote $NEWSPEC -- commit it, then: mise run release" +""" + +[tasks.release] +description = "Tag the committed version, push the tag, upload to luarocks.org" +depends = ["check"] +dir = "{{config_root}}" +run = """ +set -eu +SPEC="$(ls -1 ./*.rockspec)" +case "$SPEC" in *" +"*) echo "expected exactly one rockspec, found:" >&2; echo "$SPEC" >&2; exit 1;; esac + +VER="$(sed -n 's/^version = "\\(.*\\)-[0-9]*"/\\1/p' "$SPEC")" +[ -n "$VER" ] || { echo "could not read version from $SPEC" >&2; exit 1; } +TAG="v$VER" + +# jj's working copy is itself a commit, so @ is normally the empty commit a +# `jj new` just made and the release content sits in @-. Override with +# REV=@ (or any revset) when that is not the case. +REV="${REV:-@-}" + +# The tag is what `luarocks upload` clones to build the .src.rock, so the +# rockspec being published has to already be in the revision being tagged. +# Uncommitted, they diverge silently: the upload would ship a rockspec that +# says $VER over sources from a commit that never had it. +if ! jj file show -r "$REV" "$SPEC" 2>/dev/null | diff -q - "$SPEC" >/dev/null 2>&1; then + echo "$SPEC at $REV differs from the working copy -- commit it first" >&2 + exit 1 +fi + +if jj tag list | grep -q "^$TAG:"; then + echo "tag $TAG already exists -- bump the version first" >&2 + exit 1 +fi + +# jj 0.42 creates tags natively and exports them to git in a colocated repo, +# but `jj git push` only pushes bookmarks -- tags still need git. +jj tag set "$TAG" -r "$REV" +jj tag list | grep "^$TAG:" +for remote in $(git remote); do + git push "$remote" "$TAG" +done + +# Reads the API key from ~/.luarocks/upload_config.lua. Packs a .src.rock by +# cloning source.url at the tag just pushed, so the push has to come first. +luarocks upload "$SPEC" +""" diff --git a/panto-herdr-scm-1.rockspec b/panto-herdr-0.1.0-1.rockspec index d974b69..7d64cd2 100644 --- a/panto-herdr-scm-1.rockspec +++ b/panto-herdr-0.1.0-1.rockspec @@ -1,10 +1,10 @@ rockspec_format = "3.0" package = "panto-herdr" -version = "scm-1" +version = "0.1.0-1" source = { - -- Replace when the repository has a public remote. - url = "git+https://example.invalid/panto-herdr.git", + url = "git+https://code.tjp.lol/public/panto-herdr.git", + tag = "v0.1.0", } description = { @@ -13,7 +13,9 @@ description = { A panto extension that reports panto lifecycle state to Herdr when it runs inside a Herdr pane. ]], + homepage = "https://code.tjp.lol/public/panto-herdr", license = "MIT", + labels = { "ai", "llm", "agent", "panto", "pantograph", "extension", "herdr" }, } dependencies = { |
