Skip to content
1        10        20        30        40        50        60        70        80        90        1001#!/usr/bin/env bash2set -euo pipefail34#MISE description="Cut a release: bump the patch version in Cargo.toml, then build & push silenloc/fig:<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. `docker buildx build --push` builds the image from the Dockerfile using12#      the newly bumped version and streams it straight to the registry13#      (expects `docker login` to be configured already). Building and pushing14#      in one pass skips the local image-store round trip a separate15#      `docker build` + `docker push` pays for.16#   3. Commit the bumped Cargo.toml and push to the default branch.17#18# `--provenance=false` keeps the result a plain single-arch manifest: SLSA19# attestations turn it into a manifest list and add extra blobs to export and20# upload for no benefit here.21#22# Note: releases use `docker build` rather than `mise oci build` because the23# experimental OCI builder cannot RUN commands — it can neither apt-install24# the runtime `git` dependency nor create the non-root user, both of which25# broke the 0.1.86–0.1.88 images on the VPS.2627# 1. Read the current version from Cargo.toml's [package].version line28#    (awk scoped to [package] so dependency `version = "..."` lines are ignored).29v=$(awk '/^\[package\]/      { p=1; next }30         p && /^version = / { sub(/^version = /, ""); gsub(/"/, ""); print; exit }' Cargo.toml)3132# 2. Compute the next patch version.33major=$(echo "$v" | cut -d. -f1)34minor=$(echo "$v" | cut -d. -f2)35patch=$(echo "$v" | cut -d. -f3)36patch=$((patch + 1))37nv="$major.$minor.$patch"3839# 3. Rewrite the first `version = "..."` line under [package] in-place.40awk -v new="$nv" '41  /^\[package\]/      { p=1; print; next }42  p && /^version = / { $0 = "version = \"" new "\""; p=0 }43  { print }44' Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml4546# 4. Build the release image and push it as silenloc/pokedex:<nv> in one pass.47docker buildx build --provenance=false --push -t "silenloc/pokedex:$nv" -t "silenloc/pokedex:latest" .4849# 5. Commit the bumped Cargo.toml and push to the default branch.50git add .51git commit -m "chore: release $nv"52git push5354echo "bumped Cargo.toml to $nv; released silenloc/pokedex:$nv"