virittaa

Log | Files | Refs | README | LICENSE

commit a53937dbafce481629b057e12964f8f8f2863d34
parent 6865860ceb6cf4ae5248b35632f9568f241415bb
Author: mtmn <miro@haravara.org>
Date:   Thu,  7 May 2026 10:42:01 +0200

feat: add release script

Diffstat:
MCargo.lock | 24++++++++++++------------
Acliff.toml | 45+++++++++++++++++++++++++++++++++++++++++++++
Mflake.nix | 8++++++--
Ahack/release | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 118 insertions(+), 14 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -636,9 +636,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.97" +version = "0.3.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf" +checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" dependencies = [ "cfg-if", "futures-util", @@ -1311,9 +1311,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1" +checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" dependencies = [ "cfg-if", "once_cell", @@ -1324,9 +1324,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103" +checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1334,9 +1334,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41" +checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" dependencies = [ "bumpalo", "proc-macro2", @@ -1347,18 +1347,18 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea" +checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" -version = "0.3.97" +version = "0.3.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602" +checksum = "4b572dff8bcf38bad0fa19729c89bb5748b2b9b1d8be70cf90df697e3a8f32aa" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/cliff.toml b/cliff.toml @@ -0,0 +1,45 @@ +[changelog] +header = "# Changelog\n\n" +body = """ +{% if version -%} +## [{{ version | trim_start_matches(pat="v") }}]{% if previous.version %} - {{ timestamp | date(format="%Y-%m-%d") }}{% endif %} + +{% else -%} +## [Unreleased] + +{% endif -%} +{% for group, commits in commits | group_by(attribute="group") -%} +### {{ group }} + +{% for commit in commits -%} +- {% if commit.breaking %}**breaking:** {% endif -%} +{% if commit.scope %}**{{ commit.scope }}:** {% endif -%} +{{ commit.message | upper_first }} \ +([`{{ commit.id | truncate(length=7, end="") }}`](https://git.sr.ht/~mtmn/virittaa/commit/{{ commit.id }})) +{% endfor %} +{% endfor %} +""" +footer = "" +trim = true + +[git] +conventional_commits = true +filter_unconventional = true +split_commits = false +commit_parsers = [ + { message = "^feat", group = "Features" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^docs", group = "Documentation" }, + { message = "^test", group = "Testing" }, + { message = "^chore\\(deps\\)", group = "Dependencies" }, + { message = "^chore", skip = true }, + { message = "^ci", skip = true }, +] +protect_breaking_commits = true +filter_commits = true +tag_pattern = "v[0-9].*" +topo_order = false +sort_commits = "oldest" + +[bump] +initial_tag = "v0.1.0" diff --git a/flake.nix b/flake.nix @@ -40,11 +40,15 @@ llvmPackages.libclang ]; + cargoToml = fromTOML (builtins.readFile ./Cargo.toml); + commonArgs = { - inherit src; pname = "virittaa"; - version = "0.1.0"; + inherit src; + inherit (cargoToml.package) version; + strictDeps = true; + LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${pkgs.glibc.dev}/include -isystem ${pkgs.llvmPackages.libclang.lib}/lib/clang/${pkgs.llvmPackages.libclang.version}/include"; diff --git a/hack/release b/hack/release @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +set -euo pipefail + +require() { + command -v "$1" &>/dev/null || { + echo "error: $1 not found" + exit 1 + } +} +require git +require git-cliff + +# --- pre-flight --- + +if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then + echo "error: not on master branch" + exit 1 +fi + +if [ -n "$(git status --porcelain)" ]; then + echo "error: working tree is dirty" + exit 1 +fi + +# --- version calculation --- + +next=$(git-cliff --bumped-version | sed 's/^v//') + +if git tag | grep -qx "v$next"; then + echo "no releasable commits since v$next" + exit 0 +fi + +echo "releasing -> v$next" + +# --- update Cargo.toml --- + +sed -i "s/^version = .*/version = \"$next\"/" Cargo.toml +cargo generate-lockfile +git add Cargo.toml Cargo.lock + +# --- changelog --- + +git-cliff --tag "v$next" --output CHANGELOG.md +sed -i -e :a -e '/^\s*$/{$d;N;ba' -e '}' CHANGELOG.md +git add CHANGELOG.md + +git commit -m "chore: release v$next" + +# --- tag and push --- + +git tag "v$next" +git push origin master --tags + +echo "released v$next successfully"