#!/usr/bin/lilush -- .githooks/reference-transaction (git config core.hooksPath .githooks) -- arg[1] is the transaction state; ref updates arrive on stdin as -- " " lines. if arg[1] ~= "committed" then os.exit(0) end local site = os.getenv("LILPACK_SITE_DIR") if not site then os.exit(0) end local lilpack = require("shell.builtins.lilpack") for line in io.lines() do local _, _, ref = line:match("^(%S+)%s+(%S+)%s+(%S+)$") local tag = ref and ref:match("^refs/tags/(%d+%.%d+%.%d+%S*)$") if tag then lilpack["lilpack"].func("lilpack", { "pack", ".", "--version", tag, "--publish", site }) end end