diff --git a/justfile b/justfile index 5c2b722..0147c3e 100644 --- a/justfile +++ b/justfile @@ -34,3 +34,6 @@ compile-all: publish-docs branch="gh-pages": ./scripts/publish-docs.sh "{{branch}}" + +publish-release version: + ./scripts/publish-release.sh "{{version}}" diff --git a/scripts/publish-release.sh b/scripts/publish-release.sh new file mode 100755 index 0000000..ca599ab --- /dev/null +++ b/scripts/publish-release.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euo pipefail + +version="${1:?Usage: ./scripts/publish-release.sh }" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +cd "$repo_root" + +confirm() { + local prompt="$1" + local response + read -r -p "$prompt [y/N] " response + case "$response" in + y|Y|yes|YES) + return 0 + ;; + *) + return 1 + ;; + esac +} + +confirm "Did you bump src/constants.ts VERSION?" || { + echo "Aborting publish-release." + exit 1 +} + +confirm "Did you bump package.json version?" || { + echo "Aborting publish-release." + exit 1 +} + +confirm "Did you update CHANGELOG.md?" || { + echo "Aborting publish-release." + exit 1 +} + +git tag "v${version}" +git push origin --tags +bun publish --dry-run +bun publish --access public +echo "Go test the binary install, dummy."