commit - 9e8448028c925b352290fd78bec02da092edcc82
commit + 97c3babd3afee6ace88ed88e2b8bdd7089ab5964
blob - b5f77592963c5a7d0901fee9334620cc654e269c (mode 644)
blob + /dev/null
--- CHANGELOG.md
+++ /dev/null
-# Changelog
-
-## [0.3.0] - 2026-06-07
-
-### Features
-
-- Implement shirts.conf config file ([`661cdd7`](https://git.sr.ht/~mtmn/virittaa/commit/661cdd753622c141165f3d41c58290f370eb7f82))
-
-## [0.2.1] - 2026-06-07
-
-### Bug Fixes
-
-- Missing host in config.exs ([`8339a06`](https://git.sr.ht/~mtmn/virittaa/commit/8339a06b1df1dc87134c1f08d8c35bd1bdfb5c01))
-- Safer queries, formatter, http codes ([`b291aa6`](https://git.sr.ht/~mtmn/virittaa/commit/b291aa607fc3e8b52957105d157bd7f45a39f007))
-
-## [0.2.0] - 2026-06-05
-
-### Features
-
-- Nix devshell ([`f558c3f`](https://git.sr.ht/~mtmn/virittaa/commit/f558c3fb8bf9a20a25157ca81ca0509a1b2b9a7a))
-
-## [0.1.1] - 2026-05-08
-
-### Bug Fixes
-
-- Wording ([`594ab2d`](https://git.sr.ht/~mtmn/virittaa/commit/594ab2d5653f4384b54d6a3df45c75a33edd66cd))
-
-## [0.1.0]
-
-### Features
-
-- Init ([`a661165`](https://git.sr.ht/~mtmn/virittaa/commit/a661165cc7bc169b44fc78c8f76d04e720826524))
-- Add release script ([`d8ff748`](https://git.sr.ht/~mtmn/virittaa/commit/d8ff7486b6a709a9f7ec76aa641095d9f15cb7df))
-- Add prek ([`4421bf9`](https://git.sr.ht/~mtmn/virittaa/commit/4421bf938683cf28aa43b3e939729947e1efe7cb))
-- Use elixir-overlay in flake.nix ([`4d54e12`](https://git.sr.ht/~mtmn/virittaa/commit/4d54e12d2156b98f4223c2a04e454632b484cbdb))
blob - e81a8279a202d1afa9fb4e088ec45c66d99f8321 (mode 644)
blob + /dev/null
--- cliff.toml
+++ /dev/null
-[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"
blob - 16c33ad25e7a5f58923f47d3c0840ed852782823
blob + 721120b8b850cb9d2f263f6708ce7bf5488b439e
--- hack/release
+++ hack/release
#!/usr/bin/env bash
set -euo pipefail
+cd "$(dirname "$0")/.."
-require() {
- command -v "$1" &>/dev/null || {
- echo "error: $1 not found"
- exit 1
- }
-}
-require git
-require git-cliff
+BRANCH="master"
+REMOTE="origin"
-# --- pre-flight ---
-
-if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
- echo "error: not on master branch"
+die() {
+ echo "error: $*" >&2
exit 1
-fi
+}
-if [ -n "$(git status --porcelain)" ]; then
- echo "error: working tree is dirty"
- exit 1
-fi
+update_version_file() {
+ local version="$1"
+ if [ -f mix.exs ]; then
+ sed -i "s/version: \"[^\"]*\"/version: \"$version\"/" mix.exs
+ git add mix.exs
+ fi
+ if [ -f flake.nix ]; then
+ sed -i "s/version = \"[^\"]*\";/version = \"$version\";/" flake.nix
+ git add flake.nix
+ fi
+}
-# --- version calculation ---
+command -v git >/dev/null 2>&1 || die "git not found"
-next=$(git-cliff --bumped-version | sed 's/^v//')
+current=$(git tag --list 'v[0-9]*' --sort=-v:refname | head -n1)
+current=${current#v}
+usage="$(basename "$0") <version> [--push] (${current:-none})"
-if git tag | grep -qx "v$next"; then
- echo "no releasable commits since v$next"
- exit 0
-fi
+version=""
+push=0
+for arg in "$@"; do
+ case "$arg" in
+ --push) push=1 ;;
+ -*) die "unknown flag: $arg" ;;
+ *)
+ [ -z "$version" ] || die "unexpected argument: $arg"
+ version="$arg"
+ ;;
+ esac
+done
-echo "releasing -> v$next"
+[ -n "$version" ] || die "$usage"
+echo "$version" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)*$' ||
+ die "'$version' is not a semantic version"
-# --- update versions ---
+[ "$(git rev-parse --abbrev-ref HEAD)" = "$BRANCH" ] || die "not on $BRANCH branch"
+[ -z "$(git status --porcelain)" ] || die "working tree is dirty"
+git rev-parse -q --verify "refs/tags/v$version" >/dev/null 2>&1 && die "tag v$version already exists"
-sed -i "s/version: \"[^\"]*\"/version: \"$next\"/" mix.exs
-sed -i "s/version = \"[^\"]*\";/version = \"$next\";/" flake.nix
-git add mix.exs flake.nix
+update_version_file "$version"
-# --- changelog ---
+git commit -m "chore: release v$version"
+git tag -a "v$version" -m "v$version"
-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"
+if [ "$push" -eq 1 ]; then
+ git push "$REMOTE" "$BRANCH" --follow-tags
+fi