commit 723366de89c724652ab3c1dd8b79683fda38cd05 from: mtmn date: Sun Jun 14 19:40:49 2026 UTC build: streamline release commit - c34b2a36cee0d31a9e0290121bf79bc85650b830 commit + 723366de89c724652ab3c1dd8b79683fda38cd05 blob - /dev/null blob + 5450b5e469b53d6a6999c61dc84164707cf07010 (mode 644) --- /dev/null +++ .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 blob - 4335645c0da44c52b3dfa4da3f391d2f8fceee2d (mode 644) blob + /dev/null --- CHANGELOG.md +++ /dev/null @@ -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)) blob - 520dc5c299bf268ac67f93a0e8901ac216324c03 blob + f916ab07c7da1caa5aadd08957dbdea1788a8fed --- README.md +++ README.md @@ -1,4 +1,5 @@ # scores +[![builds.sr.ht status](https://builds.sr.ht/~mtmn/scores.svg)](https://builds.sr.ht/~mtmn/scores?) A command-line tool that displays football scores and league standings from football-data.org. blob - fd565e60d24d401adcf14eb49e27abab1b9108e9 (mode 644) blob + /dev/null --- cliff.toml +++ /dev/null @@ -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" blob - a19044bb26872c4fd68183c0d350cdeb28693025 blob + 601775c00272aebd8c3263d97b2767108ea7a385 --- hack/release +++ 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 +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" + [ -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 +} -# --- 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") [--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 Cargo.toml --- +[ "$(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\"/" Cargo.toml -cargo generate-lockfile -git add Cargo.toml Cargo.lock +update_version_file "$version" -# --- changelog --- +git commit -m "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