commit 723366de89c724652ab3c1dd8b79683fda38cd05
parent c34b2a36cee0d31a9e0290121bf79bc85650b830
Author: mtmn <miro@haravara.org>
Date: Sun, 14 Jun 2026 21:40:49 +0200
build: streamline release
Diffstat:
5 files changed, 64 insertions(+), 115 deletions(-)
diff --git a/.build.yml b/.build.yml
@@ -0,0 +1,19 @@
+image: archlinux
+packages:
+ - rustup
+ - base-devel
+ - cmake
+ - clang
+ - pkgconf
+ - sqlite
+sources:
+ - https://git.sr.ht/~mtmn/scores
+tasks:
+ - setup: |
+ rustup default stable
+ - test: |
+ cd scores
+ cargo test
+ - build: |
+ cd scores
+ cargo build --release
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -1,29 +0,0 @@
-# Changelog
-
-## [0.1.2] - 2026-05-07
-
-### Bug Fixes
-
-- Fix tests and mismatched types ([`a9e4a3e`](https://git.sr.ht/~mtmn/scores/commit/a9e4a3e6c6d1734057c2f241bbca4b41702dff25))
-
-### Housekeeping
-
-- Add gitignore ([`7d5acdf`](https://git.sr.ht/~mtmn/scores/commit/7d5acdf47d9b7afacd44d71c64af0c00e3782a11))
-
-## [0.1.1] - 2026-05-07
-
-### Housekeeping
-
-- Add license ([`99bd9c0`](https://git.sr.ht/~mtmn/scores/commit/99bd9c06c4199a4e97a171d6e50ce6fbdc85c638))
-- Release v0.1.1 ([`fdd7af9`](https://git.sr.ht/~mtmn/scores/commit/fdd7af94d578e5ec5ac25c6bf4e9329ad2c84617))
-
-## [0.1.0]
-
-### Features
-
-- Init ([`baa3ba3`](https://git.sr.ht/~mtmn/scores/commit/baa3ba3065ea3788dc658a03a30a652f692766d5))
-- Add flake and release script ([`4cdc2c8`](https://git.sr.ht/~mtmn/scores/commit/4cdc2c819a60f89274ec06fff3683bd82c9beba1))
-
-### Housekeeping
-
-- Release v0.1.0 ([`ec5b8bf`](https://git.sr.ht/~mtmn/scores/commit/ec5b8bfca8119917fae763ef11fecaf7606cf20f))
diff --git a/README.md b/README.md
@@ -1,4 +1,5 @@
# scores
+[](https://builds.sr.ht/~mtmn/scores?)
A command-line tool that displays football scores and league standings from football-data.org.
diff --git a/cliff.toml b/cliff.toml
@@ -1,45 +0,0 @@
-[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/scores/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", group = "Housekeeping" },
- { message = "^chore\\(deps\\)", group = "Dependencies" },
- { 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/hack/release b/hack/release
@@ -1,55 +1,58 @@
#!/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
-
-# --- pre-flight ---
+BRANCH="master"
+REMOTE="origin"
-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
-
-# --- 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_version_file() {
+ local version="$1"
+ [ -f Cargo.toml ] || return 0
+ sed -i "s/^version = .*/version = \"$version\"/" Cargo.toml
+ git add Cargo.toml
+ if command -v cargo >/dev/null 2>&1; then
+ cargo generate-lockfile
+ [ -f Cargo.lock ] && git add Cargo.lock
+ fi
+}
-# --- update Cargo.toml ---
+command -v git >/dev/null 2>&1 || die "git not found"
-sed -i "s/^version = .*/version = \"$next\"/" Cargo.toml
-cargo generate-lockfile
-git add Cargo.toml Cargo.lock
+current=$(git tag --list 'v[0-9]*' --sort=-v:refname | head -n1)
+current=${current#v}
+usage="$(basename "$0") <version> [--push] (${current:-none})"
-# --- changelog ---
+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
-git-cliff --tag "v$next" --output CHANGELOG.md
-sed -i -e :a -e '/^\s*$/{$d;N;ba' -e '}' CHANGELOG.md
-git add CHANGELOG.md
+[ -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"
-git commit -m "chore: release v$next"
+[ "$(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"
-# --- tag and push ---
+update_version_file "$version"
-git tag "v$next"
-git push origin master --tags
+git commit -m "release: v$version"
+git tag -a "v$version" -m "v$version"
-echo "released v$next successfully"
+if [ "$push" -eq 1 ]; then
+ git push "$REMOTE" "$BRANCH" --follow-tags
+fi