Files
zulip/static/shared/tools/npm-postversion
Greg Price 8810203a4c shared: Prescribe atomic push when bumping version.
This way, if the maintainer isn't able to update `main`,
the push doesn't add the shared-VERSION tag either.
That avoids ending up with a tag that potentially doesn't
get included in the history of the main branch.

The Git docs warn that servers might or might not support this
feature, but GitHub does -- indeed they boasted about it when it
first came out, in Git 2.4 back in 2015:
  https://github.blog/2015-04-30-git-2-4-atomic-pushes-push-to-deploy-and-more/
2022-11-01 22:25:37 -07:00

30 lines
604 B
Bash
Executable File

#!/usr/bin/env bash
set -eu -o pipefail
# expect this to run as NPM script
: "${npm_package_version?}"
should_color=
if [ -t 2 ]; then # if we're sending to a terminal
should_color=yes
fi
reset=
bold=
if [ -n "${should_color}" ]; then
reset=$'\033'[0m
bold=$'\033'[1m
fi
echo >&2 "\
Version updated: ${bold}${npm_package_version}${reset}
Next steps:
\$ ${bold}git log --stat -p upstream..${reset} # check your work!
\$ ${bold}git push --atomic upstream main shared-${npm_package_version}${reset}
\$ ${bold}npm publish${reset} # should prompt for an OTP, from your 2FA setup
"