LINE1 10 20 30 40 50 60 70 80 90 100 110 1201#!/usr/bin/env bash2set -euo pipefail34#MISE description="Cut a release: bump patch version, build multi-platform installers, then build & push silenloc/notify:<v>"5# Always run, even if nothing changed: no `sources`/`outputs` markers, which6# would otherwise let mise cache-skip the task when Cargo.toml is older than7# the last produced icon index. Releasing must always bump + build + push.89# Cut a release:10# 1. Bump the patch component of [package].version in-place.11# 2. Build multi-platform binaries and installers (Linux & macOS) into dist/.12# 3. `docker buildx build --push` builds the image from the Dockerfile using13# the newly bumped version and streams it straight to the registry14# (expects `docker login` to be configured already). Building and pushing15# in one pass skips the local image-store round trip a separate16# `docker build` + `docker push` pays for.17# 4. Commit the bumped Cargo.toml and push to the default branch.18#19# `--provenance=false` keeps the result a plain single-arch manifest: SLSA20# attestations turn it into a manifest list and add extra blobs to export and21# upload for no benefit here.22#23# Note: releases use `docker build` rather than `mise oci build` because the24# experimental OCI builder cannot RUN commands — it can neither apt-install25# the runtime `git` dependency nor create the non-root user, both of which26# broke the 0.1.86–0.1.88 images on the VPS.2728# 1. Read the current version from Cargo.toml's [package].version line29# (awk scoped to [package] so dependency `version = "..."` lines are ignored).30v=$(awk '/^\[package\]/ { p=1; next }31 p && /^version = / { sub(/^version = /, ""); gsub(/"/, ""); print; exit }' Cargo.toml)3233# 2. Compute the next patch version.34major=$(echo "$v" | cut -d. -f1)35minor=$(echo "$v" | cut -d. -f2)36patch=$(echo "$v" | cut -d. -f3)37patch=$((patch + 1))38nv="$major.$minor.$patch"3940# 3. Rewrite the first `version = "..."` line under [package] in-place.41awk -v new="$nv" '42 /^\[package\]/ { p=1; print; next }43 p && /^version = / { $0 = "version = \"" new "\""; p=0 }44 { print }45' Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml4647# 4. Build multi-platform binaries and installers for all platforms into dist/48echo "==> Building multi-platform installers and binaries for all platforms..."49ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"50"${ROOT_DIR}/scripts/build-installers.sh"5152# 5. Build the release image and push it as silenloc/notify:<nv> in one pass.53docker buildx build --provenance=false --push -t "silenloc/notify:$nv" -t "silenloc/notify:latest" .5455# 6. Commit the bumped Cargo.toml and push to the default branch.56git add .57git commit -m "chore: release $nv"58git push5960echo "bumped Cargo.toml to $nv; released silenloc/notify:$nv"