From 55f28777f60f26cca6cfc11ba097a913fb15b645 Mon Sep 17 00:00:00 2001 From: Dmytro Stanchiev Date: Sun, 19 Apr 2026 18:31:13 -0400 Subject: [PATCH] release script Signed-off-by: Dmytro Stanchiev --- release.sh | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) mode change 100644 => 100755 release.sh diff --git a/release.sh b/release.sh old mode 100644 new mode 100755 index 6b86ab6..0f44a5b --- a/release.sh +++ b/release.sh @@ -1,13 +1,40 @@ #! /usr/bin/env nix -#! nix shell nixpkgs#nodejs --command bash +#! nix shell nixpkgs#bash nixpkgs#bun nixpkgs#git nixpkgs#nodejs --command bash + +set -euo pipefail + +if [[ $# -ne 1 ]]; then + printf 'Usage: %s \n' "$0" >&2 + exit 1 +fi + +version="$1" +branch="$(git branch --show-current)" + +if [[ "$branch" != "main" ]]; then + printf 'Release must run from main, current branch: %s\n' "$branch" >&2 + exit 1 +fi + +if [[ -n "$(git status --porcelain)" ]]; then + printf 'Working tree must be clean before releasing.\n' >&2 + exit 1 +fi + +git fetch origin main --tags + +if ! git merge-base --is-ancestor origin/main HEAD; then + printf 'Local main is behind origin/main. Pull or rebase before releasing.\n' >&2 + exit 1 +fi bun run typecheck bun run clean bun run build -npm version "$1" +npm version "$version" git push origin main -git push origin "v$1" +git push origin "v$version" # vim: set ft=bash :