diff options
Diffstat (limited to 'mise.toml')
| -rw-r--r-- | mise.toml | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..65e47b8 --- /dev/null +++ b/mise.toml @@ -0,0 +1,53 @@ +[tasks.check] +description = "Run the self-check inside panto's interpreter" +dir = "{{config_root}}" +run = "panto 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')}}" +set -- ./*.rockspec +[ "$#" -eq 1 ] || { echo "expected exactly one rockspec, found $#" >&2; exit 1; } +SPEC="$1" +PKG="$(sed -n 's/^package = \"\\(.*\\)\"/\\1/p' "$SPEC")" +NEWSPEC="./$PKG-$NEW-1.rockspec" +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 +set -- ./*.rockspec +[ "$#" -eq 1 ] || { echo "expected exactly one rockspec, found $#" >&2; exit 1; } +SPEC="$1" +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" +REV="${REV:-@-}" +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 tag set "$TAG" -r "$REV" +jj tag list | grep "^$TAG:" +for remote in $(git remote); do + git push "$remote" "$TAG" +done +luarocks upload "$SPEC" +""" |
