41 lines
820 B
Bash
Executable File
41 lines
820 B
Bash
Executable File
#! /usr/bin/env nix
|
|
#! nix shell nixpkgs#bash nixpkgs#bun nixpkgs#git nixpkgs#nodejs --command bash
|
|
|
|
set -euo pipefail
|
|
|
|
if [[ $# -ne 1 ]]; then
|
|
printf 'Usage: %s <version>\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 "$version"
|
|
|
|
git push origin main
|
|
git push origin "v$version"
|
|
|
|
# vim: set ft=bash :
|